Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of MediocratesRussianRoulette v1.0.0
MediocratesRussianRoulette.dll
Decompiled 7 months 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 On.RoR2; using RoR2; 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 = "")] [assembly: AssemblyCompany("MediocratesRussianRoulette")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MediocratesRussianRoulette")] [assembly: AssemblyTitle("MediocratesRussianRoulette")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace MediocratesRussianRoulette; internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("MediocratesLIVE.MediocratesRussianRoulettePlugin", "MediocratesRussianRoulettePlugin", "1.3.0")] public class MediocratesRussianRoulettePlugin : BaseUnityPlugin { public const string PluginGUID = "MediocratesLIVE.MediocratesRussianRoulettePlugin"; public const string PluginAuthor = "MediocratesLIVE"; public const string PluginName = "MediocratesRussianRoulettePlugin"; public const string PluginVersion = "1.3.0"; public List<string> PlayersThatLostRoulette = new List<string>(); public void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal; PreGameController.OnEnable += new hook_OnEnable(PreGameController_OnEnable); } private void PreGameController_OnEnable(orig_OnEnable orig, PreGameController self) { Debug.Log((object)"Player returned to the character selection screen!"); PlayersThatLostRoulette.Clear(); orig.Invoke(self); } private void Update() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_013f: 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_00fb: Unknown result type (might be due to invalid IL or missing references) if (!Input.GetKeyDown((KeyCode)283)) { return; } CharacterMaster master = PlayerCharacterMasterController.instances[0].master; Transform transform = master.GetBodyObject().transform; Log.Info($"Player pressed F2. Spawning our custom item at coordinates {transform.position}"); if (PlayersThatLostRoulette.Contains(((Object)transform).name)) { Chat.AddMessage($"{((Object)transform).name}... You lost already so you can't play again!"); return; } Chat.AddMessage($"{((Object)transform).name}... Welcome to Russian Roulette!"); int num = 6; int num2 = new Random().Next(1, num + 1); int num3 = new Random().Next(1, num + 1); Chat.AddMessage("Pulling the trigger..."); if (num3 == num2) { Chat.AddMessage("BANG! You lose. Here's your Egocentrism!"); PlayersThatLostRoulette.Add(((Object)transform).name); ItemIndex val = (ItemIndex)161; master.inventory.GiveItem(val, 1); } else { Chat.AddMessage("Click! You survived. Here's a random Tier 3 Item!"); List<ItemIndex> tier3ItemList = ItemCatalog.tier3ItemList; ItemIndex randomItem = GetRandomItem(tier3ItemList); PickupIndex val2 = PickupCatalog.FindPickupIndex(randomItem); PickupDropletController.CreatePickupDroplet(val2, transform.position, transform.forward * 20f); } } private void GlobalEventManager_onCharacterDeathGlobal(DamageReport report) { CharacterBody body = PlayerCharacterMasterController.instances[0].body; if ((Object)(object)report.victimBody == (Object)(object)body) { Log.Info("you died maybe"); PlayersThatLostRoulette.Clear(); } } private static T GetRandomItem<T>(List<T> list) { Random random = new Random(); return list[random.Next(list.Count)]; } }