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 Isaacs mod v1.5.0
ExamplePlugin.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using ExamplePlugin.Utilities; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using RoR2; using RoR2.Artifacts; using UnityEngine; using UnityEngine.AddressableAssets; [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.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("ExamplePlugin")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ExamplePlugin")] [assembly: AssemblyTitle("ExamplePlugin")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ExamplePlugin { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("AuthorName.ExamplePlugin", "ExamplePlugin", "1.0.0")] public class ExamplePlugin : BaseUnityPlugin { public const string PluginGUID = "AuthorName.ExamplePlugin"; public const string PluginAuthor = "AuthorName"; public const string PluginName = "ExamplePlugin"; public const string PluginVersion = "1.0.0"; private static ItemDef myItemDef; public void Awake() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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) //IL_00a5: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); myItemDef = ScriptableObject.CreateInstance<ItemDef>(); ((Object)myItemDef).name = "Fuzzy_Dice"; myItemDef.nameToken = "Fuzzy_dice"; myItemDef.pickupToken = "Fuzzy_Dice"; myItemDef.descriptionToken = "Give them a slap!"; myItemDef.loreToken = "__"; myItemDef._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier3Def.asset").WaitForCompletion(); myItemDef.pickupIconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion(); myItemDef.pickupModelPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion(); myItemDef.canRemove = true; myItemDef.hidden = false; ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null); ItemAPI.Add(new CustomItem(myItemDef, val)); PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin); } private void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, activator); CharacterBody component = ((Component)activator).GetComponent<CharacterBody>(); int itemCount = component.inventory.GetItemCount(myItemDef); if (itemCount > 0 && Util.CheckRoll(12f, component.master)) { DropShipCall(((Component)self).transform, 1, TeamManager.instance.GetTeamLevel(component.teamComponent.teamIndex), itemCount, (ItemTier)0); } } public static void DropShipCall(Transform origin, int tierWeight, uint teamLevel = 1u, int amount = 1, ItemTier forcetier = 0) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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_00b9: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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) float num = (float)tierWeight * (ROR2.InverseHyperbolicScaling(1f, 0.1f, 6f, (int)teamLevel) / (((float)(int)teamLevel + 14f) / (float)(int)teamLevel)); List<PickupIndex> list = (((int)forcetier == 4) ? Run.instance.availableBossDropList : (((int)forcetier == 3) ? Run.instance.availableLunarCombinedDropList : (Util.CheckRoll(1f * num, 0f, (CharacterMaster)null) ? Run.instance.availableTier3DropList : ((!Util.CheckRoll(20f * num, 0f, (CharacterMaster)null)) ? Run.instance.availableTier1DropList : Run.instance.availableTier2DropList)))); if (amount > 1) { float num2 = 360f / (float)amount; Vector3 val = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * 15f + Vector3.forward * (4.75f + 0.25f * (float)amount)); Quaternion val2 = Quaternion.AngleAxis(num2, Vector3.up); for (int i = 0; i < amount; i++) { int index = Run.instance.treasureRng.RangeInt(0, list.Count); PickupDropletController.CreatePickupDroplet(list[index], origin.position, val); val = val2 * val; } } else { int index2 = Run.instance.treasureRng.RangeInt(0, list.Count); PickupDropletController.CreatePickupDroplet(list[index2], origin.position, new Vector3(0f, 15f, 0f)); } } private void Update() { //IL_0030: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_009e: 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) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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) //IL_00e7: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_00f3: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Expected O, but got Unknown //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_01a1: Expected O, but got Unknown //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)285)) { Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex), transform.position, transform.forward * 20f); } if (Input.GetKeyDown((KeyCode)286)) { CharacterMaster master = PlayerCharacterMasterController.instances[0].master; MasterCopySpawnCard val = MasterCopySpawnCard.FromMaster(master, true, true, (Action<CharacterMaster>)null); ((SpawnCard)val).DoSpawn(((Component)master).transform.position, Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up), new DirectorSpawnRequest((SpawnCard)(object)val, new DirectorPlacementRule { placementMode = (PlacementMode)4, minDistance = 3f, maxDistance = 20f, spawnOnTarget = ((Component)master).transform }, Run.instance.treasureRng) { teamIndexOverride = (TeamIndex)1 }); } if (Input.GetKeyDown((KeyCode)287)) { CharacterMaster master2 = PlayerCharacterMasterController.instances[0].master; MasterCopySpawnCard val2 = MasterCopySpawnCard.FromMaster(master2, true, true, (Action<CharacterMaster>)null); ((SpawnCard)val2).DoSpawn(((Component)master2).transform.position, Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up), new DirectorSpawnRequest((SpawnCard)(object)val2, new DirectorPlacementRule { placementMode = (PlacementMode)4, minDistance = 3f, maxDistance = 20f, spawnOnTarget = ((Component)master2).transform }, Run.instance.treasureRng) { teamIndexOverride = (TeamIndex)2 }); } if (Input.GetKeyDown((KeyCode)288)) { Transform transform2 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; PickupDef val3 = CommandArtifactManager.myArtifact.CreatePickupDef(); val3.itemTier = (ItemTier)0; PickupDropletController.CreatePickupDroplet(val3.pickupIndex, transform2.position, transform2.forward * 20f); } if (Input.GetKeyDown((KeyCode)289)) { CharacterMaster master3 = PlayerCharacterMasterController.instances[0].master; foreach (PlayerCharacterMasterController item in PlayerCharacterMasterController.instances.Where((PlayerCharacterMasterController p) => (int)p.master.teamIndex == 1)) { if (!((Object)(object)item.master == (Object)(object)master3)) { master3.inventory.AddItemsFrom(item.master.inventory); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Other players inventory: {item.master.inventory.itemStacks.Length}"); } } } if (Input.GetKeyDown((KeyCode)283)) { Transform transform3 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed F2. Spawning our custom item at coordinates {transform3.position}"); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(myItemDef.itemIndex), transform3.position, transform3.forward * 20f); } } } 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); } } } namespace ExamplePlugin.Utilities { internal class ROR2 { public static float InverseHyperbolicScaling(float baseValue, float additionalValue, float maxValue, int itemCount) { return baseValue + (maxValue - baseValue) * (1f - 1f / (1f + additionalValue * (float)(itemCount - 1))); } } internal static class UnityUtilities { } }