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 MarioKartValuables v1.0.7
MarioKartValuables.dll
Decompiled 11 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("8BitAnt")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.6")] [assembly: AssemblyProduct("MarioKartValuables")] [assembly: AssemblyTitle("MarioKartValuables")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class DSValuable : MonoBehaviour { public float ringDistance = 7.5f; public GameObject phoneLight; public Sound ringTone; public Sound vibrationSound; private PhotonView photonView; public GameObject phoneMesh; private Quaternion initialRotation; protected Rigidbody rb; private List<PlayerAvatar> players; private bool playersNearby; private MeshRenderer meshRenderer; private bool phoneRinging; private bool vibrate; private bool visualsReset = true; private float joltTimer; private float joltInterval = 0.3f; public float ringIntervalTimer; private float ringIntervalMin = 10f; private float ringIntervalMax = 100f; public float ringTimer; private float ringTimerMin = 5f; private float ringTimerMax = 20f; private float maxVelocity = 0.5f; private bool reset; private float vibrateCycleTimer; private float vibrateCycleDuration = 2f; private float investigateTimer; private float investigateInterval = 2f; [Header("Top Screen Setup")] [Tooltip("The material slot index for the top screen. Default is 2.")] public int topScreenIndex = 2; public Material matTopScreenOff; public Material matTopScreenOn; [Header("Bottom Screen Setup")] [Tooltip("The material slot index for the bottom screen. Default is 5.")] public int bottomScreenIndex = 5; public Material matBottomScreenOff; public Material matBottomScreenOn; private float playerCheckTimer; private float playerCheckInterval = 0.2f; protected void Start() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) rb = ((Component)this).GetComponent<Rigidbody>(); meshRenderer = ((Component)this).GetComponentInChildren<MeshRenderer>(); SetScreensState(onState: false); initialRotation = phoneMesh.transform.localRotation; photonView = ((Component)this).GetComponent<PhotonView>(); joltTimer = joltInterval; ringIntervalTimer = Random.Range(ringIntervalMin, ringIntervalMax); ringTimer = Random.Range(ringTimerMin, ringTimerMax); } protected void Update() { RingVisuals(); ringTone.PlayLoop(phoneRinging, 10f, 10f, 1f, 1f); vibrationSound.PlayLoop(vibrate, 10f, 10f, 1f, 1f); CheckForNearbyPlayers(); } private void CheckForNearbyPlayers() { //IL_005f: 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) playerCheckTimer += Time.deltaTime; if (playerCheckTimer < playerCheckInterval) { return; } playerCheckTimer = 0f; players = SemiFunc.PlayerGetList(); foreach (PlayerAvatar player in players) { if (Vector3.Distance(((Component)player).transform.position, ((Component)this).transform.position) < ringDistance) { playersNearby = true; reset = true; break; } playersNearby = false; } } private void FixedUpdate() { if (playersNearby || reset) { PhoneRing(); } } private void RingVisuals() { //IL_0050: 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_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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_01ca: 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_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: 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_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) if (!phoneRinging) { if (!visualsReset) { SetScreensState(onState: false); phoneLight.SetActive(false); vibrate = false; vibrateCycleTimer = 0f; initialRotation = phoneMesh.transform.localRotation; visualsReset = true; } return; } if (visualsReset) { visualsReset = false; SetScreensState(onState: true); } if (!phoneLight.activeSelf) { phoneLight.SetActive(true); } vibrateCycleTimer -= Time.deltaTime; if (vibrateCycleTimer < 0f) { vibrateCycleTimer = vibrateCycleDuration; } vibrate = vibrateCycleTimer >= vibrateCycleDuration / 2f; if (vibrate) { float num = 80f; float num2 = 2f * Mathf.Sin(Time.time * num); float num3 = 2f * Mathf.Sin(Time.time * num + MathF.PI / 2f); phoneMesh.transform.localRotation = initialRotation * Quaternion.Euler(num2, 0f, num3); if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } joltTimer -= Time.deltaTime; if (joltTimer <= 0f) { Vector3 val = rb.velocity; if (((Vector3)(ref val)).magnitude < maxVelocity) { rb.AddForce(Vector3.up * 0.05f, (ForceMode)1); val = Random.insideUnitSphere; Vector3 val2 = ((Vector3)(ref val)).normalized * 0.1f; rb.AddTorque(val2, (ForceMode)1); } joltTimer = joltInterval; } } else { phoneMesh.transform.localRotation = initialRotation; } } private void SetScreensState(bool onState) { if (!((Object)(object)meshRenderer == (Object)null)) { Material[] sharedMaterials = ((Renderer)meshRenderer).sharedMaterials; Material val = (onState ? matTopScreenOn : matTopScreenOff); Material val2 = (onState ? matBottomScreenOn : matBottomScreenOff); if ((Object)(object)val != (Object)null && topScreenIndex >= 0 && topScreenIndex < sharedMaterials.Length) { sharedMaterials[topScreenIndex] = val; } if ((Object)(object)val2 != (Object)null && bottomScreenIndex >= 0 && bottomScreenIndex < sharedMaterials.Length) { sharedMaterials[bottomScreenIndex] = val2; } ((Renderer)meshRenderer).materials = sharedMaterials; } } private void PhoneRing() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } if (!phoneRinging && playersNearby) { ringIntervalTimer -= Time.deltaTime; } if (ringIntervalTimer <= 0f && ringTimer > 0f) { if (investigateTimer <= 0f) { EnemyDirector.instance.SetInvestigate(((Component)this).transform.position, 15f, false); investigateTimer = investigateInterval; } else { investigateTimer -= Time.deltaTime; } if (!phoneRinging) { phoneRinging = true; if (SemiFunc.IsMultiplayer()) { photonView.RPC("SetRingRPC", (RpcTarget)1, new object[1] { phoneRinging }); } } ringTimer -= Time.deltaTime; } else { if (!(ringTimer <= 0f)) { return; } investigateTimer = 0f; ringIntervalTimer = Random.Range(ringIntervalMin, ringIntervalMax); ringTimer = Random.Range(ringTimerMin, ringTimerMax); if (phoneRinging) { phoneRinging = false; if (SemiFunc.IsMultiplayer()) { photonView.RPC("SetRingRPC", (RpcTarget)1, new object[1] { phoneRinging }); } } if (!playersNearby) { reset = false; } } } [PunRPC] private void SetRingRPC(bool _ringing, PhotonMessageInfo _info = default(PhotonMessageInfo)) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(_info)) { phoneRinging = _ringing; } } } namespace MarioKartValuables { [BepInPlugin("8BitAnt.MarioKartValuables", "MarioKartValuables", "1.0")] public class MarioKartValuables : BaseUnityPlugin { internal static MarioKartValuables Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } }