using 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 Assets.Scripts.Inventory__Items__Pickups.Items;
using Assets.Scripts.Saves___Serialization.Progression.Achievements;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("AutoBansMegabonkItemSpawner")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Item Spawner Mod for Megabonk by AutoBans")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyInformationalVersion("1.1.3+cf9a8b90da2b56d7bfefd53edc9a8ea63dd99b66")]
[assembly: AssemblyProduct("AutoBansMegabonkItemSpawner")]
[assembly: AssemblyTitle("AutoBansMegabonkItemSpawner")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.3.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 AutoBansMegabonkItemSpawner
{
[BepInPlugin("AutoBans_MegabonkItemSpawner", "MegabonkItemSpawner", "1.1.3")]
public class AutoBansItemSpawner : BasePlugin
{
public const string MODNAME = "MegabonkItemSpawner";
public const string AUTHOR = "AutoBans";
public const string GUID = "AutoBans_MegabonkItemSpawner";
public const string VERSION = "1.1.3";
private static ConfigEntry<string> spawnKey;
private static ConfigEntry<bool> enableUI;
public static ManualLogSource log;
public AutoBansItemSpawner()
{
log = ((BasePlugin)this).Log;
}
public override void Load()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Expected O, but got Unknown
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Expected O, but got Unknown
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Expected O, but got Unknown
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Expected O, but got Unknown
ManualLogSource val = log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(14, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Loading ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("MegabonkItemSpawner");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" v");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("1.1.3");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" by ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("AutoBans");
}
val.LogInfo(val2);
spawnKey = ((BasePlugin)this).Config.Bind<string>("Controls", "UIToggleKey", "F5", "Key to press to open/close the Item Spawner UI. Available keys: https://docs.unity3d.com/ScriptReference/KeyCode.html");
enableUI = ((BasePlugin)this).Config.Bind<bool>("UI Settings", "EnableUI", true, "Enable the in-game UI spawner");
((BasePlugin)this).AddComponent<ItemSpawnerBehaviour>();
ManualLogSource val3 = log;
val2 = new BepInExInfoLogInterpolatedStringHandler(35, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Item Spawner by AutoBans loaded! :)");
}
val3.LogInfo(val2);
ManualLogSource val4 = log;
val2 = new BepInExInfoLogInterpolatedStringHandler(21, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Press ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(spawnKey.Value);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" to open the UI");
}
val4.LogInfo(val2);
ManualLogSource val5 = log;
val2 = new BepInExInfoLogInterpolatedStringHandler(12, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("UI enabled: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<bool>(enableUI.Value);
}
val5.LogInfo(val2);
ManualLogSource val6 = log;
val2 = new BepInExInfoLogInterpolatedStringHandler(35, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Edit config at: BepInEx/config/");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("AutoBans_MegabonkItemSpawner");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(".cfg");
}
val6.LogInfo(val2);
}
public static KeyCode GetSpawnKey()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
if (Enum.TryParse<KeyCode>(spawnKey.Value, ignoreCase: true, out KeyCode result))
{
return result;
}
ManualLogSource val = log;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(43, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Invalid key '");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(spawnKey.Value);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' in config. Defaulting to F5.");
}
val.LogWarning(val2);
return (KeyCode)286;
}
public static bool IsUIEnabled()
{
return enableUI.Value;
}
}
public class ItemSpawnerBehaviour : MonoBehaviour
{
private bool showUI = false;
private int selectedIndex = 0;
private int quantity = 1;
private Vector2 scrollPosition;
private string searchFilter = "";
private string lastSearchFilter = "";
private List<ItemData> allItems;
private bool itemsLoaded = false;
private List<int> filteredIndices = new List<int>();
private Rect windowRect = new Rect(20f, 20f, 450f, 600f);
private GUIStyle windowStyle;
private GUIStyle buttonStyle;
private GUIStyle selectedButtonStyle;
private GUIStyle labelStyle;
private GUIStyle boxStyle;
private GUIStyle descriptionStyle;
private bool stylesInitialized = false;
private GameObject lastPlayer = null;
private void Update()
{
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)GameManager.Instance != (Object)null && (Object)(object)GameManager.Instance.player != (Object)null)
{
if ((Object)(object)lastPlayer != (Object)(object)((Component)GameManager.Instance.player).gameObject)
{
lastPlayer = ((Component)GameManager.Instance.player).gameObject;
stylesInitialized = false;
}
if (!itemsLoaded && (Object)(object)DataManager.Instance != (Object)null)
{
LoadItemsFromDataManager();
}
}
else if ((Object)(object)lastPlayer != (Object)null)
{
lastPlayer = null;
stylesInitialized = false;
}
if (AutoBansItemSpawner.IsUIEnabled() && itemsLoaded && Input.GetKeyDown(AutoBansItemSpawner.GetSpawnKey()))
{
showUI = !showUI;
}
}
private void LoadItemsFromDataManager()
{
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
bool flag = default(bool);
try
{
if ((Object)(object)DataManager.Instance != (Object)null && DataManager.Instance.unsortedItems != null)
{
allItems = DataManager.Instance.unsortedItems;
itemsLoaded = true;
UpdateFilteredItems();
ManualLogSource log = AutoBansItemSpawner.log;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(30, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loaded ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(allItems.Count);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" items from DataManager");
}
log.LogInfo(val);
}
}
catch (Exception ex)
{
ManualLogSource log2 = AutoBansItemSpawner.log;
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(39, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to load items from DataManager: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
log2.LogError(val2);
}
}
private void OnDisable()
{
showUI = false;
stylesInitialized = false;
lastPlayer = null;
}
private void InitializeStyles()
{
//IL_0029: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: 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_00d4: 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_010e: 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_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//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_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: 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_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Expected O, but got Unknown
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: 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_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: 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_031f: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Expected O, but got Unknown
//IL_033a: 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_0348: 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)
//IL_035e: Unknown result type (might be due to invalid IL or missing references)
//IL_0364: Unknown result type (might be due to invalid IL or missing references)
//IL_036f: Unknown result type (might be due to invalid IL or missing references)
//IL_037d: Unknown result type (might be due to invalid IL or missing references)
//IL_0383: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_039c: Unknown result type (might be due to invalid IL or missing references)
//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
//IL_03da: Unknown result type (might be due to invalid IL or missing references)
//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
//IL_040a: Unknown result type (might be due to invalid IL or missing references)
//IL_0418: Unknown result type (might be due to invalid IL or missing references)
//IL_041e: Unknown result type (might be due to invalid IL or missing references)
//IL_0429: Unknown result type (might be due to invalid IL or missing references)
//IL_0437: Unknown result type (might be due to invalid IL or missing references)
//IL_043d: Unknown result type (might be due to invalid IL or missing references)
//IL_044d: Expected O, but got Unknown
//IL_0458: Unknown result type (might be due to invalid IL or missing references)
//IL_045d: Unknown result type (might be due to invalid IL or missing references)
//IL_0466: Unknown result type (might be due to invalid IL or missing references)
//IL_046e: Unknown result type (might be due to invalid IL or missing references)
//IL_0474: Unknown result type (might be due to invalid IL or missing references)
//IL_047f: Unknown result type (might be due to invalid IL or missing references)
//IL_0485: Unknown result type (might be due to invalid IL or missing references)
//IL_0490: Unknown result type (might be due to invalid IL or missing references)
//IL_0496: Unknown result type (might be due to invalid IL or missing references)
//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
//IL_04b7: Expected O, but got Unknown
//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0503: Unknown result type (might be due to invalid IL or missing references)
//IL_0509: Unknown result type (might be due to invalid IL or missing references)
//IL_0514: Unknown result type (might be due to invalid IL or missing references)
//IL_0521: Unknown result type (might be due to invalid IL or missing references)
//IL_0527: Unknown result type (might be due to invalid IL or missing references)
//IL_0532: Unknown result type (might be due to invalid IL or missing references)
//IL_053f: Unknown result type (might be due to invalid IL or missing references)
//IL_0545: Unknown result type (might be due to invalid IL or missing references)
//IL_0550: Unknown result type (might be due to invalid IL or missing references)
//IL_055d: Unknown result type (might be due to invalid IL or missing references)
//IL_0563: Unknown result type (might be due to invalid IL or missing references)
//IL_056e: Unknown result type (might be due to invalid IL or missing references)
//IL_057b: Unknown result type (might be due to invalid IL or missing references)
//IL_0581: Unknown result type (might be due to invalid IL or missing references)
//IL_058c: Unknown result type (might be due to invalid IL or missing references)
//IL_0599: Unknown result type (might be due to invalid IL or missing references)
//IL_059f: Unknown result type (might be due to invalid IL or missing references)
//IL_05aa: Unknown result type (might be due to invalid IL or missing references)
//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
//IL_05cd: Expected O, but got Unknown
//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0604: Unknown result type (might be due to invalid IL or missing references)
//IL_061e: Unknown result type (might be due to invalid IL or missing references)
//IL_0629: Unknown result type (might be due to invalid IL or missing references)
//IL_0637: Unknown result type (might be due to invalid IL or missing references)
//IL_0651: Unknown result type (might be due to invalid IL or missing references)
//IL_065c: Unknown result type (might be due to invalid IL or missing references)
//IL_066a: Unknown result type (might be due to invalid IL or missing references)
//IL_0684: Unknown result type (might be due to invalid IL or missing references)
//IL_068f: Unknown result type (might be due to invalid IL or missing references)
//IL_069d: Unknown result type (might be due to invalid IL or missing references)
//IL_06b7: Unknown result type (might be due to invalid IL or missing references)
//IL_06c2: Unknown result type (might be due to invalid IL or missing references)
//IL_06d0: Unknown result type (might be due to invalid IL or missing references)
//IL_06ea: Unknown result type (might be due to invalid IL or missing references)
//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0703: Unknown result type (might be due to invalid IL or missing references)
//IL_071d: Unknown result type (might be due to invalid IL or missing references)
//IL_0728: Unknown result type (might be due to invalid IL or missing references)
//IL_0736: Unknown result type (might be due to invalid IL or missing references)
//IL_0750: Unknown result type (might be due to invalid IL or missing references)
//IL_075b: Unknown result type (might be due to invalid IL or missing references)
//IL_0769: Unknown result type (might be due to invalid IL or missing references)
//IL_0783: Unknown result type (might be due to invalid IL or missing references)
//IL_0793: Expected O, but got Unknown
if (!stylesInitialized)
{
Texture2D background = MakeTex(2, 2, new Color(0.1f, 0.1f, 0.1f, 0.95f));
Texture2D background2 = MakeTex(2, 2, new Color(0.15f, 0.15f, 0.15f, 0.9f));
Texture2D background3 = MakeTex(2, 2, new Color(0.2f, 0.2f, 0.2f, 0.9f));
Texture2D background4 = MakeTex(2, 2, new Color(0.25f, 0.25f, 0.25f, 0.9f));
Texture2D background5 = MakeTex(2, 2, new Color(0.2f, 0.6f, 0.2f, 0.9f));
Texture2D background6 = MakeTex(2, 2, new Color(0.25f, 0.65f, 0.25f, 0.9f));
Texture2D background7 = MakeTex(2, 2, new Color(0.12f, 0.12f, 0.12f, 0.95f));
GUIStyle val = new GUIStyle(GUI.skin.window)
{
fontSize = 16,
fontStyle = (FontStyle)1
};
val.normal.background = background;
val.normal.textColor = Color.white;
val.hover.background = background;
val.hover.textColor = Color.white;
val.active.background = background;
val.active.textColor = Color.white;
val.focused.background = background;
val.focused.textColor = Color.white;
val.onNormal.background = background;
val.onNormal.textColor = Color.white;
val.onHover.background = background;
val.onHover.textColor = Color.white;
val.onActive.background = background;
val.onActive.textColor = Color.white;
val.onFocused.background = background;
val.onFocused.textColor = Color.white;
windowStyle = val;
GUIStyle val2 = new GUIStyle(GUI.skin.button)
{
fontSize = 14,
alignment = (TextAnchor)3
};
val2.normal.background = background3;
val2.normal.textColor = Color.white;
val2.hover.background = background4;
val2.hover.textColor = Color.white;
val2.active.background = background3;
val2.active.textColor = Color.white;
val2.focused.background = background3;
val2.focused.textColor = Color.white;
val2.onNormal.background = background3;
val2.onNormal.textColor = Color.white;
val2.onHover.background = background4;
val2.onHover.textColor = Color.white;
val2.onActive.background = background3;
val2.onActive.textColor = Color.white;
val2.onFocused.background = background3;
val2.onFocused.textColor = Color.white;
buttonStyle = val2;
GUIStyle val3 = new GUIStyle(GUI.skin.button)
{
fontSize = 14,
alignment = (TextAnchor)4
};
val3.normal.background = background5;
val3.normal.textColor = Color.white;
val3.hover.background = background6;
val3.hover.textColor = Color.white;
val3.active.background = background5;
val3.active.textColor = Color.white;
val3.focused.background = background5;
val3.focused.textColor = Color.white;
val3.onNormal.background = background5;
val3.onNormal.textColor = Color.white;
val3.onHover.background = background6;
val3.onHover.textColor = Color.white;
val3.onActive.background = background5;
val3.onActive.textColor = Color.white;
val3.onFocused.background = background5;
val3.onFocused.textColor = Color.white;
selectedButtonStyle = val3;
GUIStyle val4 = new GUIStyle(GUI.skin.label)
{
fontSize = 14,
fontStyle = (FontStyle)1
};
val4.normal.textColor = Color.white;
val4.hover.textColor = Color.white;
val4.active.textColor = Color.white;
val4.focused.textColor = Color.white;
labelStyle = val4;
GUIStyle val5 = new GUIStyle(GUI.skin.box)
{
fontSize = 16,
alignment = (TextAnchor)4
};
val5.normal.background = background2;
val5.normal.textColor = Color.white;
val5.hover.background = background2;
val5.hover.textColor = Color.white;
val5.active.background = background2;
val5.active.textColor = Color.white;
val5.focused.background = background2;
val5.focused.textColor = Color.white;
val5.onNormal.background = background2;
val5.onNormal.textColor = Color.white;
val5.onHover.background = background2;
val5.onHover.textColor = Color.white;
val5.onActive.background = background2;
val5.onActive.textColor = Color.white;
val5.onFocused.background = background2;
val5.onFocused.textColor = Color.white;
boxStyle = val5;
GUIStyle val6 = new GUIStyle(GUI.skin.box)
{
fontSize = 12,
alignment = (TextAnchor)0,
wordWrap = true
};
val6.normal.background = background7;
val6.normal.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
val6.hover.background = background7;
val6.hover.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
val6.active.background = background7;
val6.active.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
val6.focused.background = background7;
val6.focused.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
val6.onNormal.background = background7;
val6.onNormal.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
val6.onHover.background = background7;
val6.onHover.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
val6.onActive.background = background7;
val6.onActive.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
val6.onFocused.background = background7;
val6.onFocused.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
descriptionStyle = val6;
descriptionStyle.padding.left = 8;
descriptionStyle.padding.right = 8;
descriptionStyle.padding.top = 8;
descriptionStyle.padding.bottom = 8;
stylesInitialized = true;
}
}
private Texture2D MakeTex(int width, int height, Color col)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
Color[] array = (Color[])(object)new Color[width * height];
for (int i = 0; i < array.Length; i++)
{
array[i] = col;
}
Texture2D val = new Texture2D(width, height);
val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
val.Apply();
return val;
}
private void OnGUI()
{
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Invalid comparison between Unknown and I4
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Invalid comparison between Unknown and I4
if (!AutoBansItemSpawner.IsUIEnabled() || !showUI || !itemsLoaded)
{
return;
}
if ((Object)(object)GameManager.Instance == (Object)null || (Object)(object)GameManager.Instance.player == (Object)null)
{
showUI = false;
return;
}
InitializeStyles();
if (Event.current != null && (int)Event.current.type == 4)
{
if ((int)Event.current.keyCode == 8 && searchFilter.Length > 0)
{
searchFilter = searchFilter.Substring(0, searchFilter.Length - 1);
Event.current.Use();
}
else if (Event.current.character != 0 && !char.IsControl(Event.current.character))
{
searchFilter += Event.current.character;
Event.current.Use();
}
}
windowRect = GUI.Window(0, windowRect, WindowFunction.op_Implicit((Action<int>)DrawWindow), "Item Spawner by AutoBans", windowStyle);
}
private void DrawWindow(int windowID)
{
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: 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_00ff: 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_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_02da: Unknown result type (might be due to invalid IL or missing references)
//IL_031e: 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)
//IL_0385: Unknown result type (might be due to invalid IL or missing references)
//IL_0412: Unknown result type (might be due to invalid IL or missing references)
//IL_0415: Unknown result type (might be due to invalid IL or missing references)
//IL_041a: Unknown result type (might be due to invalid IL or missing references)
//IL_041c: Unknown result type (might be due to invalid IL or missing references)
//IL_0421: Unknown result type (might be due to invalid IL or missing references)
//IL_0510: Unknown result type (might be due to invalid IL or missing references)
//IL_0476: Unknown result type (might be due to invalid IL or missing references)
//IL_047d: Expected O, but got Unknown
//IL_049a: Unknown result type (might be due to invalid IL or missing references)
if (allItems == null || allItems.Count == 0)
{
return;
}
float num = 30f;
float num2 = 10f;
float num3 = 25f;
float num4 = 35f;
float num5 = 40f;
float num6 = ((Rect)(ref windowRect)).width - num2 * 2f;
if (selectedIndex >= allItems.Count)
{
selectedIndex = 0;
}
ItemData val = allItems[selectedIndex];
GUI.Label(new Rect(num2, num, num6, num3), "Selected Item:", labelStyle);
num += num3;
GUI.Box(new Rect(num2, num, num6, num4), ((UnlockableBase)val).GetName(), boxStyle);
num += num4 + num2;
GUI.Label(new Rect(num2, num, num6 / 2f, 20f), $"Rarity: {val.rarity}", labelStyle);
num += 22f;
GUI.Label(new Rect(num2, num, num6, num3), "Description:", labelStyle);
num += num3 - 5f;
string text = ((UnlockableBase)val).GetDescription();
if (string.IsNullOrEmpty(text))
{
text = "No description available.";
}
float num7 = 60f;
GUI.Box(new Rect(num2, num, num6, num7), text, descriptionStyle);
num += num7 + num2;
GUI.Label(new Rect(num2, num, num6 / 2f, num3), "Quantity:", labelStyle);
num += num3;
float num8 = 5f;
float num9 = (num6 - num8 * 4f) / 5f;
if (GUI.Button(new Rect(num2, num, num9, num4), "-10"))
{
quantity = Mathf.Max(1, quantity - 10);
}
if (GUI.Button(new Rect(num2 + num9 + num8, num, num9, num4), "-1"))
{
quantity = Mathf.Max(1, quantity - 1);
}
GUI.Box(new Rect(num2 + (num9 + num8) * 2f, num, num9, num4), quantity.ToString(), boxStyle);
if (GUI.Button(new Rect(num2 + (num9 + num8) * 3f, num, num9, num4), "+1"))
{
quantity++;
}
if (GUI.Button(new Rect(num2 + (num9 + num8) * 4f, num, num9, num4), "+10"))
{
quantity += 10;
}
num += num4 + num2;
if (GUI.Button(new Rect(num2, num, num6, num5), "Spawn Item", selectedButtonStyle))
{
SpawnItem(val, quantity);
}
num += num5 + num2 * 2f;
GUI.Label(new Rect(num2, num, num6 - 80f, num3), "Search: " + searchFilter, labelStyle);
if (GUI.Button(new Rect(num6 - 70f + num2, num, 60f, num3), "Clear"))
{
searchFilter = "";
}
num += num3 + 5f;
GUI.Label(new Rect(num2, num, num6, 20f), "(Type to search)", GUI.skin.label);
num += 20f + num2;
float num10 = 180f;
Rect val2 = default(Rect);
((Rect)(ref val2))..ctor(num2, num, num6, num10);
if (searchFilter != lastSearchFilter)
{
UpdateFilteredItems();
lastSearchFilter = searchFilter;
}
Rect val3 = default(Rect);
((Rect)(ref val3))..ctor(0f, 0f, num6 - 20f, (float)(filteredIndices.Count * 30));
scrollPosition = GUI.BeginScrollView(val2, scrollPosition, val3);
float num11 = 0f;
for (int i = 0; i < filteredIndices.Count; i++)
{
int num12 = filteredIndices[i];
ItemData val4 = allItems[num12];
GUIStyle val5 = ((num12 == selectedIndex) ? selectedButtonStyle : buttonStyle);
GUIStyle val6 = new GUIStyle(val5);
val6.alignment = (TextAnchor)3;
if (GUI.Button(new Rect(5f, num11, num6 - 25f, 28f), " " + ((UnlockableBase)val4).GetName(), val6))
{
selectedIndex = num12;
}
num11 += 30f;
}
GUI.EndScrollView();
GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref windowRect)).width, 30f));
}
private void UpdateFilteredItems()
{
filteredIndices.Clear();
for (int i = 0; i < allItems.Count; i++)
{
ItemData val = allItems[i];
if (string.IsNullOrEmpty(searchFilter) || ((UnlockableBase)val).GetName().IndexOf(searchFilter, StringComparison.OrdinalIgnoreCase) >= 0)
{
filteredIndices.Add(i);
}
}
}
private void SpawnItem(ItemData item, int quantity)
{
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Expected O, but got Unknown
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
//IL_0109: 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_0138: Expected O, but got Unknown
bool flag = default(bool);
try
{
ManualLogSource log = AutoBansItemSpawner.log;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(22, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Attempting to spawn ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(quantity);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("x ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((UnlockableBase)item).GetName());
}
log.LogInfo(val);
if ((Object)(object)GameManager.Instance == (Object)null)
{
AutoBansItemSpawner.log.LogError((object)"GameManager.Instance is null!");
return;
}
if ((Object)(object)GameManager.Instance.player == (Object)null)
{
AutoBansItemSpawner.log.LogError((object)"Player is null!");
return;
}
if (GameManager.Instance.player.inventory == null)
{
AutoBansItemSpawner.log.LogError((object)"Player inventory is null!");
return;
}
ItemInventory itemInventory = GameManager.Instance.player.inventory.itemInventory;
if (itemInventory == null)
{
AutoBansItemSpawner.log.LogError((object)"ItemInventory is null!");
return;
}
for (int i = 0; i < quantity; i++)
{
itemInventory.AddItem(item.eItem);
}
ManualLogSource log2 = AutoBansItemSpawner.log;
val = new BepInExInfoLogInterpolatedStringHandler(24, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Successfully spawned ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(quantity);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("x ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((UnlockableBase)item).GetName());
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("!");
}
log2.LogInfo(val);
}
catch (Exception ex)
{
ManualLogSource log3 = AutoBansItemSpawner.log;
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(21, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Error spawning item: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
log3.LogError(val2);
AutoBansItemSpawner.log.LogError((object)ex.StackTrace);
}
}
}
}