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 No Limits Arsenal v1.0.6
No_Limits_Arsenal.dll
Decompiled 4 days agousing System; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace NoLimitsArsenalMod; [BepInPlugin("com.atakakota.nolimitsarsenal", "No Limits Arsenal", "1.0.6")] public class NoLimitsArsenalPlugin : BaseUnityPlugin { public static NoLimitsArsenalPlugin Instance; public static ConfigEntry<bool> InfiniteMobSouls; public static ConfigEntry<bool> RestockPurchasedWeapons; private bool showMenu = false; private Rect windowRect = new Rect(60f, 60f, 420f, 360f); private CursorLockMode prevLockMode = (CursorLockMode)0; private bool prevCursorVisible = true; private GUIStyle winStyle; private GUIStyle headerStyle; private GUIStyle labelStyle; private GUIStyle subLabelStyle; private GUIStyle toggleStyle; private GUIStyle btnStyle; private Texture2D winBg; private bool stylesInit = false; private void Awake() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown Instance = this; InfiniteMobSouls = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "InfiniteMobSouls", true, "Removes the drop cap on mob souls. Normal combat enemies drop soul spheres indefinitely. Gnomes do not drop souls. / Бесконечный фарм душ с боевых мобов (с гномов души не падают)"); RestockPurchasedWeapons = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "RestockPurchasedWeapons", true, "Allows purchased weapons (like shotguns) to naturally appear in future shops again with normal price and chance, and guarantees all duplicate copies spawn in truck / Оружие снова появляется в магазинах и гарантированно спавнится в траке"); Harmony val = new Harmony("com.atakakota.nolimitsarsenal"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"No Limits Arsenal v1.0.6 loaded successfully!"); } private void Update() { //IL_0069: 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_0046: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)282) || Input.GetKeyDown((KeyCode)277)) { showMenu = !showMenu; if (showMenu) { prevLockMode = Cursor.lockState; prevCursorVisible = Cursor.visible; Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } else { Cursor.lockState = prevLockMode; Cursor.visible = prevCursorVisible; ((BaseUnityPlugin)this).Config.Save(); } } } private void InitStyles() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_010f: 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_012f: Expected O, but got Unknown //IL_0148: 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_0168: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Expected O, but got Unknown //IL_0234: Unknown result type (might be due to invalid IL or missing references) if (!stylesInit) { winBg = new Texture2D(1, 1); winBg.SetPixel(0, 0, new Color(0.09f, 0.08f, 0.14f, 0.95f)); winBg.Apply(); winStyle = new GUIStyle(GUI.skin.window); winStyle.normal.background = winBg; winStyle.onNormal.background = winBg; winStyle.normal.textColor = Color.white; winStyle.padding = new RectOffset(16, 16, 16, 16); headerStyle = new GUIStyle(GUI.skin.label); headerStyle.fontSize = 14; headerStyle.fontStyle = (FontStyle)1; headerStyle.normal.textColor = new Color(0.95f, 0.45f, 1f); labelStyle = new GUIStyle(GUI.skin.label); labelStyle.fontSize = 12; labelStyle.normal.textColor = Color.white; subLabelStyle = new GUIStyle(GUI.skin.label); subLabelStyle.fontSize = 11; subLabelStyle.normal.textColor = new Color(0.72f, 0.75f, 0.82f); toggleStyle = new GUIStyle(GUI.skin.toggle); toggleStyle.fontSize = 12; toggleStyle.normal.textColor = Color.white; toggleStyle.onNormal.textColor = new Color(0.4f, 1f, 0.5f); btnStyle = new GUIStyle(GUI.skin.button); btnStyle.fontSize = 12; btnStyle.fontStyle = (FontStyle)1; btnStyle.normal.textColor = Color.white; stylesInit = true; } } private void OnGUI() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0037: 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) if (showMenu) { InitStyles(); windowRect = GUI.Window(889900, windowRect, new WindowFunction(DrawWindow), "No Limits Arsenal v1.0.5", winStyle); } } private void DrawWindow(int id) { //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(6f); GUILayout.Label("── ДУШИ С МОБОВ (INFINITE MOB SOULS) ──", headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); InfiniteMobSouls.Value = GUILayout.Toggle(InfiniteMobSouls.Value, " Бесконечные сферы-души с мобов", toggleStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Снимает ванильный лимит (3 сферы) с боевых мобов. С гномов и летающих черепов сферы не падают.", subLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(12f); GUILayout.Label("── МАГАЗИН (WEAPONS RESTOCK & SPAWN) ──", headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); RestockPurchasedWeapons.Value = GUILayout.Toggle(RestockPurchasedWeapons.Value, " Повторное появление оружия в магазинах", toggleStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Купленное оружие (дробовик и др.) не пропадает из игры навсегда. Оно сможет снова появиться в следующем магазине по своей обычной цене, а все купленные копии гарантированно спавнятся в траке.", subLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(16f); if (GUILayout.Button("Закрыть меню (F1)", btnStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { showMenu = false; Cursor.lockState = prevLockMode; Cursor.visible = prevCursorVisible; ((BaseUnityPlugin)this).Config.Save(); } GUILayout.EndVertical(); GUI.DragWindow(new Rect(0f, 0f, 10000f, 30f)); } public static bool IsExcludedEnemy(Enemy enemy, EnemyParent parent) { if ((Object)(object)enemy == (Object)null && (Object)(object)parent == (Object)null) { return false; } if ((Object)(object)enemy != (Object)null) { if ((Object)(object)((Component)enemy).GetComponent<EnemyGnome>() != (Object)null || (Object)(object)((Component)enemy).GetComponentInChildren<EnemyGnome>() != (Object)null) { return true; } if ((Object)(object)((Component)enemy).GetComponent<EnemyBang>() != (Object)null || (Object)(object)((Component)enemy).GetComponentInChildren<EnemyBang>() != (Object)null) { return true; } EnemyTick val = ((Component)enemy).GetComponent<EnemyTick>() ?? ((Component)enemy).GetComponentInChildren<EnemyTick>(); if ((Object)(object)val != (Object)null) { EnemyTickAnim val2 = ((Component)enemy).GetComponent<EnemyTickAnim>() ?? ((Component)enemy).GetComponentInChildren<EnemyTickAnim>(); if ((Object)(object)val2 != (Object)null && !val2.hasBeenFull) { return true; } if ((Object)(object)val2 == (Object)null) { int value = Traverse.Create((object)val).Field("stolenHealth").GetValue<int>(); if (value <= 0) { return true; } } } } string text = ""; if ((Object)(object)parent != (Object)null && !string.IsNullOrEmpty(parent.enemyName)) { text = parent.enemyName; } else if ((Object)(object)enemy != (Object)null && !string.IsNullOrEmpty(((Object)enemy).name)) { text = ((Object)enemy).name; } if (!string.IsNullOrEmpty(text)) { string text2 = text.ToLowerInvariant(); if (text2.Contains("gnome") || text2.Contains("banger") || text2.Contains("bang")) { return true; } } return false; } public static void UnlockItemLimits() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Invalid comparison between Unknown and I4 //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Invalid comparison between Unknown and I4 //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Invalid comparison between Unknown and I4 //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Invalid comparison between Unknown and I4 //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Invalid comparison between Unknown and I4 //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Invalid comparison between Unknown and I4 //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Invalid comparison between Unknown and I4 //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Invalid comparison between Unknown and I4 //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Invalid comparison between Unknown and I4 //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Invalid comparison between Unknown and I4 //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Invalid comparison between Unknown and I4 //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Invalid comparison between Unknown and I4 //IL_0122: 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_0130: Invalid comparison between Unknown and I4 try { if ((Object)(object)StatsManager.instance == (Object)null || StatsManager.instance.itemDictionary == null) { return; } foreach (KeyValuePair<string, Item> item in StatsManager.instance.itemDictionary) { Item value = item.Value; if (!((Object)(object)value == (Object)null) && (int)value.itemType != 5 && (int)value.itemType != 4 && (int)value.itemType != 3 && (string.IsNullOrEmpty(((Object)value).name) || ((Object)value).name.IndexOf("Crystal", StringComparison.OrdinalIgnoreCase) < 0) && (value.physicalItem || (int)value.itemType == 9 || (int)value.itemType == 7 || (int)value.itemType == 15 || (int)value.itemType == 6 || (int)value.itemType == 11 || (int)value.itemType == 13 || (int)value.itemType == 2 || (int)value.itemType == 12 || (int)value.itemType == 10 || (int)value.itemType == 0 || (int)value.itemType == 8)) { value.maxAmount = 999; value.maxPurchase = false; value.maxPurchaseAmount = 999; int num = SemiFunc.StatGetItemsPurchased(((Object)value).name); value.maxAmountInShop = num + 1; } } } catch (Exception) { } } } [HarmonyPatch(typeof(EnemyParent), "Despawn")] public static class Patch_EnemyParent_Despawn { public static void Prefix(EnemyParent __instance) { if ((Object)(object)__instance == (Object)null || !NoLimitsArsenalPlugin.InfiniteMobSouls.Value) { return; } try { Traverse val = Traverse.Create((object)__instance); Enemy value = val.Field("Enemy").GetValue<Enemy>(); if ((Object)(object)value == (Object)null) { return; } Traverse val2 = Traverse.Create((object)value); EnemyHealth val3 = val2.Field("Health").GetValue<EnemyHealth>(); if ((Object)(object)val3 == (Object)null) { val3 = ((Component)value).GetComponentInChildren<EnemyHealth>(); } if ((Object)(object)val3 == (Object)null) { return; } if (NoLimitsArsenalPlugin.IsExcludedEnemy(value, __instance)) { val3.spawnValuable = false; return; } Traverse val4 = Traverse.Create((object)val3); int value2 = val4.Field("healthCurrent").GetValue<int>(); if (value2 <= 0) { val3.spawnValuable = true; val3.spawnValuableMax = 999999; val4.Field("spawnValuableCurrent").SetValue((object)0); val.Field("valuableSpawnTimer").SetValue((object)15f); } } catch (Exception ex) { Debug.LogError((object)("[No Limits Arsenal] Error in Patch_EnemyParent_Despawn: " + ex)); } } } [HarmonyPatch(typeof(EnemyHealth), "Awake")] public static class Patch_EnemyHealth_Awake { public static void Postfix(EnemyHealth __instance) { if ((Object)(object)__instance == (Object)null || !NoLimitsArsenalPlugin.InfiniteMobSouls.Value) { return; } try { Enemy enemy = ((Component)__instance).GetComponent<Enemy>() ?? ((Component)__instance).GetComponentInParent<Enemy>(); if (NoLimitsArsenalPlugin.IsExcludedEnemy(enemy, null)) { __instance.spawnValuable = false; return; } __instance.spawnValuable = true; __instance.spawnValuableMax = 999999; Traverse.Create((object)__instance).Field("spawnValuableCurrent").SetValue((object)0); } catch (Exception ex) { Debug.LogError((object)("[No Limits Arsenal] Error in Patch_EnemyHealth_Awake: " + ex)); } } } [HarmonyPatch(typeof(ShopManager), "GetAllItemsFromStatsManager")] public static class Patch_ShopManager_GetAllItemsFromStatsManager { public static void Prefix(ShopManager __instance) { if (!((Object)(object)__instance == (Object)null) && NoLimitsArsenalPlugin.RestockPurchasedWeapons.Value) { NoLimitsArsenalPlugin.UnlockItemLimits(); } } } [HarmonyPatch(typeof(StatsManager), "ItemPurchase", new Type[] { typeof(string) })] public static class Patch_StatsManager_ItemPurchase { public static void Postfix(string itemName) { if (NoLimitsArsenalPlugin.RestockPurchasedWeapons.Value) { NoLimitsArsenalPlugin.UnlockItemLimits(); } } } [HarmonyPatch(typeof(ItemManager), "GetPurchasedItems")] public static class Patch_ItemManager_GetPurchasedItems { public static void Prefix(ItemManager __instance) { if (NoLimitsArsenalPlugin.RestockPurchasedWeapons.Value) { NoLimitsArsenalPlugin.UnlockItemLimits(); } } public static void Postfix(ItemManager __instance) { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: 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_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Expected O, but got Unknown //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || !NoLimitsArsenalPlugin.RestockPurchasedWeapons.Value || SemiFunc.IsNotMasterClient()) { return; } try { if (__instance.purchasedItems == null || __instance.itemVolumes == null) { return; } __instance.purchasedItems.RemoveAll((Item it) => (Object)(object)it != (Object)null && ((int)it.itemType == 5 || (!string.IsNullOrEmpty(((Object)it).name) && ((Object)it).name.IndexOf("Crystal", StringComparison.OrdinalIgnoreCase) >= 0))); List<ItemVolume> list = new List<ItemVolume>(__instance.itemVolumes); List<Item> list2 = new List<Item>(__instance.purchasedItems); List<Item> list3 = new List<Item>(); foreach (Item item in list2) { if (!((Object)(object)item == (Object)null) && (int)item.itemType != 5) { int num = list.FindIndex((ItemVolume v) => (Object)(object)v != (Object)null && v.itemVolume == item.itemVolume); if (num >= 0) { list.RemoveAt(num); } else { list3.Add(item); } } } if (list3.Count == 0) { return; } ItemVolume val = __instance.itemVolumes.Find((ItemVolume v) => (Object)(object)v != (Object)null); Vector3 val2 = (((Object)(object)val != (Object)null) ? ((Component)val).transform.position : Vector3.zero); Quaternion rotation = (((Object)(object)val != (Object)null) ? ((Component)val).transform.rotation : Quaternion.identity); Transform val3 = (((Object)(object)val != (Object)null) ? ((Component)val).transform.parent : null); int num2 = 0; Vector3 val6 = default(Vector3); foreach (Item item2 in list3) { num2++; GameObject val4; ItemVolume val5; if ((Object)(object)val != (Object)null) { val4 = Object.Instantiate<GameObject>(((Component)val).gameObject, val3); val5 = val4.GetComponent<ItemVolume>(); } else { val4 = new GameObject("Mod_Extra_ItemVolume"); val5 = val4.AddComponent<ItemVolume>(); } if ((Object)(object)val5 != (Object)null) { val5.itemVolume = item2.itemVolume; ((Vector3)(ref val6))..ctor(((num2 % 2 == 0) ? 0.35f : (-0.35f)) * (float)((num2 + 1) / 2), 0.05f * (float)num2, 0.1f * (float)(num2 % 3)); val4.transform.position = val2 + val6; val4.transform.rotation = rotation; __instance.itemVolumes.Add(val5); } } } catch (Exception) { } } }