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 Russian Roulette v1.0.2
RussianRoulette.dll
Decompiled 8 months agousing System; 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.Configuration; 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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RussianRoulette")] [assembly: AssemblyTitle("RussianRoulette")] [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; } } } namespace RussianRoulette { [BepInPlugin("Omniscye.RussianRoulette", "RussianRoulette", "1.0")] public class RussianRoulette : BaseUnityPlugin { internal static RussianRoulette 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() { } } } namespace Empress.Mods.RepoRussianRoulette { [BepInPlugin("empress.repo.russianroulette", "Empress Russian Roulette", "1.2.0")] public sealed class RussianRoulettePlugin : BaseUnityPlugin { public const string PluginGuid = "empress.repo.russianroulette"; public const string PluginName = "Empress Russian Roulette"; public const string PluginVersion = "1.2.0"; internal static ConfigEntry<float> ChancePercent; internal static ConfigEntry<float> ExplosionSize; internal static ConfigEntry<int> ExplosionDamagePlayer; internal static ConfigEntry<int> ExplosionDamageEnemy; internal static ConfigEntry<float> ForceMultiplier; internal static ConfigEntry<bool> OnlyParticleEffect; internal static ConfigEntry<bool> DisableSound; internal static ConfigEntry<float> ShakeMultiplier; private Harmony _harmony; private void Awake() { //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown ChancePercent = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ChancePercent", 10f, "Percent chance for a shot to explode (0–100)."); ExplosionSize = ((BaseUnityPlugin)this).Config.Bind<float>("Explosion", "Size", 0.85f, "Explosion size for visuals and radius."); ExplosionDamagePlayer = ((BaseUnityPlugin)this).Config.Bind<int>("Explosion", "DamageToPlayers", 50, "Damage to players in radius."); ExplosionDamageEnemy = ((BaseUnityPlugin)this).Config.Bind<int>("Explosion", "DamageToEnemies", 100, "Damage to enemies in radius."); ForceMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Explosion", "ForceMultiplier", 1.5f, "Physics impulse multiplier."); OnlyParticleEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("Explosion", "OnlyParticleEffect", false, "If true, spawn VFX only (no damage/force)."); DisableSound = ((BaseUnityPlugin)this).Config.Bind<bool>("Explosion", "DisableSound", false, "Mute any AudioSources on the explosion prefab."); ShakeMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Explosion", "ShakeMultiplier", 1f, "Camera shake multiplier (VFX prefab only)."); _harmony = new Harmony("empress.repo.russianroulette"); _harmony.PatchAll(typeof(Patch_ItemGun_Start)); _harmony.PatchAll(typeof(Patch_ItemGun_ShootBulletRPC)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Empress Russian Roulette 1.2.0 loaded."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } public sealed class EmpressExplodeHelper : MonoBehaviourPun { private static GameObject _explosionPrefab; [PunRPC] public void Empress_ExplodeAtRPC(Vector3 position, float size, int dmgPlayers, int dmgEnemies, float force, bool onlyParticleEffect, bool disableSound, float shakeMultiplier, PhotonMessageInfo _info) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_explosionPrefab == (Object)null) { _explosionPrefab = Resources.Load<GameObject>("Effects/Part Prefab Explosion"); if ((Object)(object)_explosionPrefab == (Object)null) { Debug.LogWarning((object)"[EmpressRR] Resources/Effects/Part Prefab Explosion not found."); return; } } GameObject val = Object.Instantiate<GameObject>(_explosionPrefab, position, Quaternion.identity); if ((Object)(object)val == (Object)null) { return; } ParticlePrefabExplosion component = val.GetComponent<ParticlePrefabExplosion>(); if ((Object)(object)component != (Object)null) { component.explosionSize = Mathf.Max(0.05f, size); component.explosionDamage = ((!onlyParticleEffect) ? dmgPlayers : 0); component.explosionDamageEnemy = ((!onlyParticleEffect) ? dmgEnemies : 0); component.forceMultiplier = (onlyParticleEffect ? 0f : force); } if (disableSound) { AudioSource[] componentsInChildren = val.GetComponentsInChildren<AudioSource>(); foreach (AudioSource val2 in componentsInChildren) { val2.mute = true; ((Behaviour)val2).enabled = false; } } Transform transform = val.transform; transform.localScale *= Mathf.Max(0.1f, shakeMultiplier); } } [HarmonyPatch] public static class Patch_ItemGun_Start { private static MethodBase TargetMethod() { Type type = AccessTools.TypeByName("ItemGun"); return AccessTools.Method(type, "Start", (Type[])null, (Type[])null); } private static void Postfix(MonoBehaviour __instance) { GameObject gameObject = ((Component)__instance).gameObject; if ((Object)(object)gameObject.GetComponent<EmpressExplodeHelper>() == (Object)null) { gameObject.AddComponent<EmpressExplodeHelper>(); } } } [HarmonyPatch] public static class Patch_ItemGun_ShootBulletRPC { private static MethodBase TargetMethod() { Type type = AccessTools.TypeByName("ItemGun"); return AccessTools.Method(type, "ShootBulletRPC", (Type[])null, (Type[])null); } private static void Postfix(object __instance, Vector3 _endPosition, bool _hit, PhotonMessageInfo _info) { //IL_0080: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient) { return; } float num = Mathf.Clamp(RussianRoulettePlugin.ChancePercent.Value, 0f, 100f); if (num <= 0f || Random.Range(0f, 100f) > num) { return; } Component val = (Component)((__instance is Component) ? __instance : null); if ((Object)(object)val == (Object)null) { return; } Vector3 position = val.transform.position; try { FieldInfo fieldInfo = AccessTools.Field(((object)val).GetType(), "gunMuzzle"); if (fieldInfo != null) { object? value = fieldInfo.GetValue(val); Transform val2 = (Transform)((value is Transform) ? value : null); if ((Object)(object)val2 != (Object)null) { position = val2.position; } } } catch { } PhotonView component = val.GetComponent<PhotonView>(); EmpressExplodeHelper component2 = val.GetComponent<EmpressExplodeHelper>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component2 == (Object)null)) { component.RPC("Empress_ExplodeAtRPC", (RpcTarget)0, new object[8] { position, RussianRoulettePlugin.ExplosionSize.Value, RussianRoulettePlugin.ExplosionDamagePlayer.Value, RussianRoulettePlugin.ExplosionDamageEnemy.Value, RussianRoulettePlugin.ForceMultiplier.Value, RussianRoulettePlugin.OnlyParticleEffect.Value, RussianRoulettePlugin.DisableSound.Value, RussianRoulettePlugin.ShakeMultiplier.Value }); } } } }