using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Comfort.Common;
using EFT;
using EFT.Bots;
using EFT.Counters;
using EFT.Interactive;
using EFT.InventoryLogic;
using EFT.UI;
using EFT.Weather;
using Newtonsoft.Json;
using stupid.solutions;
using stupid.solutions.Data;
using stupid.solutions.Features;
using stupid.solutions.stupid.solutions.enums;
using stupid.solutions.Utils;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class Menu2 : MonoBehaviour
{
	private enum SaveType
	{
		File,
		List
	}

	private enum KeybindType
	{
		ClearCache,
		Skill,
		Aimbot,
		UnlockDoors,
		teleportitem,
		killall,
		tpall,
		instaheal,
		speedhack,
		flyhack
	}

	public class SlotData
	{
		public string SlotName { get; set; }

		public string ContainedItemId { get; set; }

		public string ContainedItemName { get; set; }

		public string ContainedItemShortName { get; set; }
	}

	public class BackpackItemData
	{
		public string ItemId { get; set; }

		public string ItemName { get; set; }

		public string ItemShortName { get; set; }

		public List<SlotData> Slots { get; set; } = new List<SlotData>();
	}

	public enum ColorCategory
	{
		ItemESP,
		ESP,
		Aimbot,
		Chams
	}

	[StructLayout(LayoutKind.Auto)]
	[CompilerGenerated]
	private struct _003CSpawnSelectedPreset_003Ed__388 : IAsyncStateMachine
	{
		private static class _003C_003Eo__388
		{
			public static CallSite<Func<CallSite, object, object>> _003C_003Ep__0;

			public static CallSite<Func<CallSite, object, object>> _003C_003Ep__1;

			public static CallSite<Func<CallSite, object, bool>> _003C_003Ep__2;

			public static CallSite<Action<CallSite, object>> _003C_003Ep__3;
		}

		public int _003C_003E1__state;

		public AsyncTaskMethodBuilder _003C_003Et__builder;

		public Menu2 _003C_003E4__this;

		private Dictionary<string, stupid.solutions.SlotData> _003CslotsDictionary_003E5__2;

		private ItemFactory _003CitemFactory_003E5__3;

		private object _003Citem_003E5__4;

		private IEnumerator _003C_003E7__wrap4;

		private TaskAwaiter _003C_003Eu__1;

		private object _003C_003Eu__2;

		private void MoveNext()
		{
			int num = _003C_003E1__state;
			Menu2 CS_0024_003C_003E8__locals6 = _003C_003E4__this;
			try
			{
				if (num == 0)
				{
					goto IL_033e;
				}
				dynamic val;
				if (num == 1)
				{
					val = _003C_003Eu__2;
					_003C_003Eu__2 = null;
					num = (_003C_003E1__state = -1);
					goto IL_0726;
				}
				if (string.IsNullOrEmpty(CS_0024_003C_003E8__locals6.selectedPresetName) || CS_0024_003C_003E8__locals6.pullItemPresets == null || CS_0024_003C_003E8__locals6.pullItemPresets.templateList == null)
				{
					ConsoleScreen.Log("No preset selected or presets list is empty.");
				}
				else
				{
					TemplateData templateData = CS_0024_003C_003E8__locals6.pullItemPresets.templateList.FirstOrDefault((TemplateData template) => template.PresetName == CS_0024_003C_003E8__locals6.selectedPresetName);
					if (templateData == null)
					{
						ConsoleScreen.Log("Selected preset not found in the list.");
					}
					else
					{
						ConsoleScreen.Log("Spawning preset: " + templateData.PresetName);
						KeyValuePair<string, stupid.solutions.ItemTemplate> keyValuePair = templateData.ItemTemplate.FirstOrDefault();
						if (keyValuePair.Value == null)
						{
							ConsoleScreen.Log("No item template found for the selected preset.");
						}
						else
						{
							string key = keyValuePair.Key;
							_003CslotsDictionary_003E5__2 = keyValuePair.Value.Slots;
							_003CitemFactory_003E5__3 = new ItemFactory();
							_003Citem_003E5__4 = _003CitemFactory_003E5__3.CreateItem(key);
							if (!(((dynamic)_003Citem_003E5__4 == null) ? true : false))
							{
								((dynamic)_003Citem_003E5__4).SpawnedInSession = true;
								dynamic val2 = ((dynamic)_003Citem_003E5__4).AllSlots;
								if (val2 != null)
								{
									_003C_003E7__wrap4 = ((IEnumerable)val2).GetEnumerator();
									goto IL_033e;
								}
								ConsoleScreen.Log("No slots found for the main item.");
								goto IL_0587;
							}
							ConsoleScreen.Log("Failed to create the main item from the template.");
						}
					}
				}
				goto end_IL_000e;
				IL_0587:
				val = CS_0024_003C_003E8__locals6.AddItemToBackpack((dynamic)_003Citem_003E5__4).GetAwaiter();
				if (!(bool)val.IsCompleted)
				{
					num = (_003C_003E1__state = 1);
					_003C_003Eu__2 = val;
					ICriticalNotifyCompletion awaiter = val as ICriticalNotifyCompletion;
					if (awaiter == null)
					{
						INotifyCompletion awaiter2 = (INotifyCompletion)(object)val;
						_003C_003Et__builder.AwaitOnCompleted(ref awaiter2, ref this);
						awaiter2 = null;
					}
					else
					{
						_003C_003Et__builder.AwaitUnsafeOnCompleted(ref awaiter, ref this);
					}
					awaiter = null;
					return;
				}
				goto IL_0726;
				IL_0726:
				val.GetResult();
				goto end_IL_000e;
				IL_033e:
				try
				{
					if (num != 0)
					{
						goto IL_0545;
					}
					TaskAwaiter awaiter3 = _003C_003Eu__1;
					_003C_003Eu__1 = default(TaskAwaiter);
					num = (_003C_003E1__state = -1);
					goto IL_053e;
					IL_053e:
					awaiter3.GetResult();
					goto IL_0545;
					IL_0545:
					if (_003C_003E7__wrap4.MoveNext())
					{
						dynamic current = _003C_003E7__wrap4.Current;
						string text = current.FullId;
						if (_003CslotsDictionary_003E5__2.TryGetValue(text, out var value))
						{
							string itemId = value.ItemId;
							Item item = _003CitemFactory_003E5__3.CreateItem(itemId);
							item.SpawnedInSession = true;
							if (item != null)
							{
								try
								{
									current.AddWithoutRestrictions(item);
									ConsoleScreen.Log("Added component item " + itemId + " to slot '" + text + "'.");
								}
								catch (Exception ex)
								{
									ConsoleScreen.Log("Error adding component to slot '" + text + "': " + ex.Message);
								}
							}
							else
							{
								ConsoleScreen.Log("Failed to create component item with ID " + itemId + ".");
							}
						}
						awaiter3 = Task.Delay(10).GetAwaiter();
						if (!awaiter3.IsCompleted)
						{
							num = (_003C_003E1__state = 0);
							_003C_003Eu__1 = awaiter3;
							_003C_003Et__builder.AwaitUnsafeOnCompleted(ref awaiter3, ref this);
							return;
						}
						goto IL_053e;
					}
				}
				finally
				{
					if (num < 0 && _003C_003E7__wrap4 is IDisposable disposable)
					{
						disposable.Dispose();
					}
				}
				_003C_003E7__wrap4 = null;
				goto IL_0587;
				end_IL_000e:;
			}
			catch (Exception exception)
			{
				_003C_003E1__state = -2;
				_003CslotsDictionary_003E5__2 = null;
				_003CitemFactory_003E5__3 = null;
				_003Citem_003E5__4 = null;
				_003C_003Et__builder.SetException(exception);
				return;
			}
			_003C_003E1__state = -2;
			_003CslotsDictionary_003E5__2 = null;
			_003CitemFactory_003E5__3 = null;
			_003Citem_003E5__4 = null;
			_003C_003Et__builder.SetResult();
		}

		void IAsyncStateMachine.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			this.MoveNext();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			_003C_003Et__builder.SetStateMachine(stateMachine);
		}

		void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine)
		{
			//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
			this.SetStateMachine(stateMachine);
		}
	}

	private QuestModule questModule;

	private AILister aILister;

	[SerializeField]
	public GameObject menu;

	[SerializeField]
	public GameObject menuBar;

	[SerializeField]
	public GameObject watermark;

	[SerializeField]
	public GameObject watermarkmagicbullet;

	[SerializeField]
	public GameObject aimbotPanel;

	[SerializeField]
	public GameObject playerESPPanel;

	[SerializeField]
	public GameObject itemESPPanel;

	[SerializeField]
	public GameObject miscOptionsPanel;

	[SerializeField]
	public GameObject settingsPanel;

	[SerializeField]
	public GameObject itemspawnpanel;

	[SerializeField]
	public GameObject aispawnpanel;

	[SerializeField]
	public Button aimbotButton;

	[SerializeField]
	public Button playerESPButton;

	[SerializeField]
	public Button itemESPButton;

	[SerializeField]
	public Button miscOptionsButton;

	[SerializeField]
	public Button settingsButton;

	[SerializeField]
	public Toggle aimbotToggle;

	[SerializeField]
	public TMP_Text aimbotSmoothLabel;

	[SerializeField]
	public Slider aimbotSmoothSlider;

	[SerializeField]
	public Toggle aimbotDrawFOVToggle;

	[SerializeField]
	public TMP_Text aimbotFOVLabel;

	[SerializeField]
	public Slider aimbotFOVSlider;

	[SerializeField]
	public Toggle noRecoilToggle;

	[SerializeField]
	public Toggle crosshairToggle;

	[SerializeField]
	public Toggle silentAimToggle;

	[SerializeField]
	public Toggle silentTargetLinesToggle;

	[SerializeField]
	public Toggle instahitToggle;

	[SerializeField]
	public Toggle ammodrawToggle;

	[SerializeField]
	public TMP_Dropdown aimboneDropdown;

	[SerializeField]
	public Toggle CheckVisibletoggle;

	[SerializeField]
	public Toggle MagicBulletToggle;

	[SerializeField]
	public Toggle infiniteammo;

	[SerializeField]
	public Toggle tracers;

	[SerializeField]
	public Toggle hitmarkers;

	[SerializeField]
	public Toggle drawPlayersToggle;

	[SerializeField]
	public Toggle drawPlayerBoxToggle;

	[SerializeField]
	public Toggle drawPlayerNameToggle;

	[SerializeField]
	public Toggle drawPlayerLineToggle;

	[SerializeField]
	public Toggle drawPlayerHealthToggle;

	[SerializeField]
	public Toggle drawWeaponToggle;

	[SerializeField]
	public Toggle enableSkeletonToggle;

	[SerializeField]
	public Toggle ChamsToggle;

	[SerializeField]
	public Toggle drawRadarToggle;

	[SerializeField]
	public Slider drawPlayersDistanceSlider;

	[SerializeField]
	public TMP_Text drawplayerdistancelabel;

	[SerializeField]
	public Toggle drawaimpostoggle;

	[SerializeField]
	public Slider radardistanceslider;

	[SerializeField]
	public TMP_Text radardistancelabel;

	[SerializeField]
	public Toggle fullbright;

	[SerializeField]
	public Toggle grenadeesp;

	[SerializeField]
	public Toggle drawLootItemsToggle;

	[SerializeField]
	public Slider drawLootItemsDistanceSlider;

	[SerializeField]
	public TMP_Text drawlootitemsdistancelabel;

	[SerializeField]
	public Toggle superRareItemsToggle;

	[SerializeField]
	public Toggle kappaItemsToggle;

	[SerializeField]
	public Toggle questItemsToggle;

	[SerializeField]
	public Toggle commonItemsToggle;

	[SerializeField]
	public Slider commonItemsDistanceSlider;

	[SerializeField]
	public TMP_Text commonItemsdistancelabel;

	[SerializeField]
	public Toggle drawLootableContainersToggle;

	[SerializeField]
	public Slider drawLootableContainersDistanceSlider;

	[SerializeField]
	public TMP_Text drawcontainerdistancelabel;

	[SerializeField]
	public Toggle bodyESPToggle;

	[SerializeField]
	public Toggle playerInventoryESPToggle;

	[SerializeField]
	public Toggle searchItemToggle;

	[SerializeField]
	public TMP_InputField searchItemInputField;

	[SerializeField]
	public Toggle teleportItemsToggle;

	[SerializeField]
	public Toggle drawExfiltrationPointsToggle;

	[SerializeField]
	public Toggle flyhackToggle;

	[SerializeField]
	public Toggle speedhackToggle;

	[SerializeField]
	public Slider speedSlider;

	[SerializeField]
	public Toggle maincamfovchanger;

	[SerializeField]
	public Slider maincamfov;

	[SerializeField]
	public Toggle infStaminaToggle;

	[SerializeField]
	public Toggle instaHealToggle;

	[SerializeField]
	public Toggle thermalVisionToggle;

	[SerializeField]
	public Toggle godmodeToggle;

	[SerializeField]
	public Toggle instaSearchToggle;

	[SerializeField]
	public Toggle noVisorToggle;

	[SerializeField]
	public Toggle flaresToggle;

	[SerializeField]
	public Toggle noJamToggle;

	[SerializeField]
	public Toggle fireRateToggle;

	[SerializeField]
	public Toggle farreachtoggle;

	[SerializeField]
	public Toggle invisibletoggle;

	[SerializeField]
	public Toggle showitemspawnmenu;

	[SerializeField]
	public Toggle weaponchams;

	[SerializeField]
	public Button spawnitembutton;

	[SerializeField]
	public Button spawnbossbutton;

	[SerializeField]
	public Button addxpsessionbutton;

	[SerializeField]
	public Button completequestbutton;

	[SerializeField]
	public Slider xpslider;

	[SerializeField]
	public TMP_Text xpsliderlabel;

	[SerializeField]
	public Toggle tppmc;

	[SerializeField]
	public Toggle tpboss;

	[SerializeField]
	public Toggle alwayssurvived;

	public static string publicSearchString = "Grenade";

	public static string itemidstring = "";

	public static string spawnid = "";

	[SerializeField]
	public Button clearCacheKeyButton;

	[SerializeField]
	public TMP_Text clearCacheKeyLabel;

	[SerializeField]
	public Button skillKeyButton;

	[SerializeField]
	public TMP_Text skillKeyLabel;

	[SerializeField]
	public Button aimbotKeyButton;

	[SerializeField]
	public TMP_Text aimbotKeyLabel;

	[SerializeField]
	public Button unlockDoorsKeyButton;

	[SerializeField]
	public TMP_Text unlockDoorsKeyLabel;

	[SerializeField]
	public Button teleportitembutton;

	[SerializeField]
	public TMP_Text teleportitemlabel;

	[SerializeField]
	public Button killallbutton;

	[SerializeField]
	public TMP_Text killalllabel;

	[SerializeField]
	public Button tpallkeybutton;

	[SerializeField]
	public TMP_Text tpallkeylabel;

	[SerializeField]
	public Button instahealkeybutton;

	[SerializeField]
	public TMP_Text instahealkeylabel;

	[SerializeField]
	private GameObject itembuttontemplate;

	[SerializeField]
	private Transform buttonContainer;

	[SerializeField]
	private TMP_InputField searchInputField;

	[SerializeField]
	private ScrollRect scrollRect;

	[SerializeField]
	public TMP_Text iteminfotext;

	[SerializeField]
	public Toggle sicc;

	[SerializeField]
	public Toggle thicc;

	[SerializeField]
	public Toggle ammobox;

	[SerializeField]
	public Toggle fillraidbp;

	[SerializeField]
	public Toggle bypassrestrictions;

	[SerializeField]
	private Transform traderbuttonContainer;

	[SerializeField]
	private ScrollRect traderscrollRect;

	[SerializeField]
	private Slider traderreputationSlider;

	[SerializeField]
	private Button applyTraderrepButton;

	[SerializeField]
	public GameObject traderreppanel;

	[SerializeField]
	public TMP_Text traderinfotext;

	[SerializeField]
	public TMP_Text traderreptoaddvalue;

	[SerializeField]
	private Transform skillButtonContainer;

	[SerializeField]
	private ScrollRect skillScrollRect;

	[SerializeField]
	private TMP_Text skillInfoText;

	[SerializeField]
	private TMP_Text skillLevelToAddText;

	[SerializeField]
	private Slider skillLevelSlider;

	[SerializeField]
	private Button applySkillButton;

	[SerializeField]
	public GameObject skillspanel;

	[SerializeField]
	private Transform presetButtonContainer;

	[SerializeField]
	private ScrollRect presetScrollRect;

	[SerializeField]
	private TMP_Text presetInfoText;

	[SerializeField]
	private Button spawnpresetitembutton;

	[SerializeField]
	private GameObject presetsPanel;

	[SerializeField]
	private TMP_InputField searchInputFieldTemplates;

	[SerializeField]
	public GameObject updatepanel;

	[SerializeField]
	private Button closeupdatebutton;

	[SerializeField]
	private TMP_Text updateinfo;

	[SerializeField]
	public Toggle stimsItemsToggle;

	[SerializeField]
	public TMP_InputField TPItemInputField;

	[SerializeField]
	public Toggle superrareTPToggle;

	[SerializeField]
	public Toggle KappaTPToggle;

	[SerializeField]
	public Toggle QuestTPToggle;

	[SerializeField]
	public Toggle StimsTPToggle;

	[SerializeField]
	public Toggle SearchTPToggle;

	[SerializeField]
	private Button saveprimaryweapon;

	[SerializeField]
	private Button loadfromfilebutton;

	[SerializeField]
	public Toggle autofillslots;

	[SerializeField]
	public GameObject aiButtonTemplate;

	[SerializeField]
	public Transform aiButtonContainer;

	[SerializeField]
	public TMP_Text aiInfoText;

	[SerializeField]
	public TMP_InputField aiSearchBar;

	[SerializeField]
	public ScrollRect aiScrollRect;

	[SerializeField]
	public GameObject helppanel;

	[SerializeField]
	private Button closehelpbutton;

	[SerializeField]
	private Button openhelpbutton;

	[SerializeField]
	public Toggle QuestESP;

	[SerializeField]
	public Toggle QuestDescription;

	[SerializeField]
	public Toggle SimplifiedStrings;

	[SerializeField]
	public Toggle DrawOutline;

	[SerializeField]
	public Toggle DrawTripWires;

	[SerializeField]
	public Toggle Artillery;

	[SerializeField]
	public Slider SkeletonUpdateSlider;

	[SerializeField]
	public Slider FONTSIZE;

	[SerializeField]
	public TMP_Text FONTSIZETXT;

	[SerializeField]
	public TMP_Text SkeletonUpdateSliderText;

	[SerializeField]
	public Toggle DrawWatermark;

	[SerializeField]
	public Toggle DurabilityExploit;

	[SerializeField]
	public Toggle DrawHideoutItems;

	[SerializeField]
	public Toggle DrawWishlistItems;

	[SerializeField]
	public Toggle DrawItemValue;

	[SerializeField]
	public Toggle filtersuperrare;

	[SerializeField]
	public Toggle filterkappa;

	[SerializeField]
	public Toggle filterquest;

	[SerializeField]
	public Toggle filterwishlist;

	[SerializeField]
	public Toggle filterstim;

	[SerializeField]
	public Toggle filterhideout;

	[SerializeField]
	public Toggle filtervalue;

	[SerializeField]
	public Slider filtervalueslider;

	[SerializeField]
	public TMP_Text filtervalueslidertext;

	[SerializeField]
	public Button addtowishlist;

	[SerializeField]
	public Button Refresh;

	[SerializeField]
	private GameObject MainColorSettingsMenu;

	[SerializeField]
	private GameObject colorButtonTemplate;

	[SerializeField]
	private Transform colorButtonContainer;

	[SerializeField]
	private GameObject colorSettingMenu;

	[SerializeField]
	private Slider redSlider;

	[SerializeField]
	private Slider greenSlider;

	[SerializeField]
	private Slider blueSlider;

	[SerializeField]
	private Image colorPreview;

	[SerializeField]
	private Button applyColorButton;

	[SerializeField]
	private TMP_Text colorNameText;

	[SerializeField]
	private TMP_Dropdown categoryDropdown;

	[SerializeField]
	private Button CancelColorButton;

	[SerializeField]
	public Slider ESPfiltervalueslider;

	[SerializeField]
	public Toggle ESPfiltervalue;

	[SerializeField]
	private TMP_Text ESPfiltervaluesliderlabel;

	[SerializeField]
	public Toggle ShowColorMenu;

	[SerializeField]
	public Button MaxWeaponSkills;

	[SerializeField]
	public Toggle TPHideoutItems;

	[SerializeField]
	public Toggle TPWishlistItems;

	[SerializeField]
	public Toggle TPHVItems;

	[SerializeField]
	public Toggle SpoofNicknameToggle;

	[SerializeField]
	public Button speedhacktogglekeybutton1;

	[SerializeField]
	public TMP_Text speedhacktogglekeylabel1;

	[SerializeField]
	public Button flyhacktogglekeybutton1;

	[SerializeField]
	public TMP_Text flyhacktogglekeylabel1;

	[SerializeField]
	public Toggle disableallinputs;

	[SerializeField]
	public TMP_Text bulletspershotLabel;

	[SerializeField]
	public Toggle bulletspershottoggle;

	[SerializeField]
	public Slider bulletspershot;

	[SerializeField]
	public Toggle bigheadstoggle;

	[SerializeField]
	public Slider ItemTPRadiusSlider;

	[SerializeField]
	public TMP_Text ItemTPRadiusLabel;

	[SerializeField]
	private GameObject TransitPanel;

	[SerializeField]
	public GameObject transitButtonTemplate;

	[SerializeField]
	public Transform transitButtonContainer;

	[SerializeField]
	public ScrollRect transitScrollRect;

	[SerializeField]
	public TMP_Text transitInfoText;

	[SerializeField]
	public Button applyTransitButton;

	[SerializeField]
	public Button senditemsTransitButton;

	[SerializeField]
	public Button canceltransitbutton;

	[SerializeField]
	public Toggle showraidsettingsmenu;

	[SerializeField]
	private TMP_Text notransitstexttmp;

	[SerializeField]
	private GameObject RaidSettingsPanel;

	[SerializeField]
	private TMP_Dropdown botAmountDropdown;

	[SerializeField]
	private TMP_Dropdown botDifficultyDropdown;

	[SerializeField]
	private Toggle taggedAndCursedToggle;

	[SerializeField]
	private Toggle scavwartoggle;

	[SerializeField]
	private Toggle metabolismDisabledToggle;

	[SerializeField]
	private TMP_Dropdown windTypeDropdown;

	[SerializeField]
	private TMP_Dropdown timeFlowTypeDropdown;

	[SerializeField]
	private TMP_Dropdown cloudinessTypeDropdown;

	[SerializeField]
	private TMP_Dropdown rainTypeDropdown;

	[SerializeField]
	public Toggle modifyraidsettingstoggle;

	[SerializeField]
	private GameObject EntityPanel;

	[SerializeField]
	private Transform entityButtonContainer;

	[SerializeField]
	private GameObject entityButtonTemplate;

	[SerializeField]
	private TMP_Text entityInfoText;

	[SerializeField]
	private ScrollRect entityScrollRect;

	[SerializeField]
	private Button killEntityButton;

	[SerializeField]
	private Button healEntityButton;

	[SerializeField]
	private Button tpEntityToCrosshairButton;

	[SerializeField]
	private Button makebraindeadbutton;

	[SerializeField]
	private Button GiveBotBlickyKit;

	[SerializeField]
	private Button GiveAllBotsBlickyKitButton;

	[SerializeField]
	private TMP_Text noentitiestexttmp;

	[SerializeField]
	public Toggle makeallbotsfriendlytoggle;

	[Header("Main Advanced Item Spawning Stuff")]
	[SerializeField]
	private Button OpenADvancedItemSpawningButton;

	[SerializeField]
	private GameObject advancedItemPanel;

	[SerializeField]
	private Button spawnadvancedButton;

	[SerializeField]
	private Button cancelButton;

	[SerializeField]
	private Button refreshSlotsButton;

	[SerializeField]
	private Button saveToFileButton;

	[SerializeField]
	private Button saveToPresetListButton;

	[Header("Buff UI")]
	[SerializeField]
	private Transform buffListContainer;

	[SerializeField]
	private GameObject buffButtonTemplate;

	[SerializeField]
	private GameObject buffEditWindow;

	[SerializeField]
	private Slider buffSlider;

	[SerializeField]
	private TMP_Text buffNameText;

	[SerializeField]
	private TMP_Text buffValueText;

	[SerializeField]
	private Button applyBuffButton;

	[SerializeField]
	private TMP_Dropdown buffTypeDropdown;

	[Header("Slot UI")]
	[SerializeField]
	private Transform slotListContainer;

	[SerializeField]
	private GameObject slotButtonTemplate;

	[Header("Slot Item Selection UI")]
	[SerializeField]
	private GameObject slotItemWindow;

	[SerializeField]
	private TMP_Text slotItemWindowTitle;

	[SerializeField]
	private TMP_Text slotItemInfoText;

	[SerializeField]
	private Transform slotCompatibleItemsContainer;

	[SerializeField]
	private GameObject compatibleItemButtonTemplate;

	[SerializeField]
	private Button cancelSlotButton;

	[SerializeField]
	private Button applySlotButton;

	[Header("Item Save Window")]
	[SerializeField]
	private Button confirmSaveButton;

	[SerializeField]
	private Button cancelSaveButton;

	[SerializeField]
	private GameObject popupWindow;

	[SerializeField]
	private TMP_InputField presetNameInput;

	private SaveType currentSaveType;

	private List<BuffComponent> cachedBuffs = new List<BuffComponent>();

	private List<(string slotName, dynamic slotRef)> cachedSlots = new List<(string, object)>();

	private BuffComponent currentEditingBuff;

	private string selectedSlotItemId;

	private dynamic currentEditingSlotRef;

	private string currentSlotName;

	private bool populatedTransits;

	private bool wasInGame;

	private int selectedTransitId = -1;

	private string selectedAIName;

	private string empty = "";

	public static string TPItemInputstring = "Grenade";

	private string selectedColorKey;

	private string selectedTraderId;

	private bool waitingForKey;

	private KeybindType currentKeybindType;

	private List<ItemData> ItemsList;

	public static Main main = new Main();

	public static PullItemIDs pullItemIDs;

	private string selectedSkillName;

	private PullItemPresets pullItemPresets;

	private string selectedPresetName;

	private bool populatedtemplates;

	public static bool showmenu = false;

	public static bool closedupdate = false;

	public static bool showhelp = false;

	public bool hidspawnmenuforcolor;

	private static int entitylistcount = 0;

	private static float entitylistupdatedelay = 5f;

	private static float nextentitycachetime;

	private static string advanceditemidcache;

	private dynamic advanceditemcache;

	public bool updatep = true;

	private float debounceTime = 0.5f;

	private Coroutine debounceCoroutine;

	private float newDebounceTime = 0.5f;

	private Coroutine newDebounceCoroutine;

	private Coroutine spawnDebounceCoroutine;

	private Coroutine searchDebounceCoroutine;

	private Coroutine aisearchDebounceCoroutine;

	private Dictionary<string, int> skillLevels = new Dictionary<string, int>
	{
		{ "Strength", 0 },
		{ "StressResistance", 0 },
		{ "MagDrills", 0 },
		{ "Melee", 0 },
		{ "HideoutManagement", 0 },
		{ "Crafting", 0 },
		{ "HeavyVests", 0 },
		{ "LightVests", 0 },
		{ "RecoilControl", 0 },
		{ "LMG", 0 },
		{ "Assault", 0 },
		{ "Pistol", 0 },
		{ "Perception", 0 },
		{ "Sniper", 0 },
		{ "Sniping", 0 },
		{ "Endurance", 0 },
		{ "Throwing", 0 },
		{ "Charisma", 0 },
		{ "BotReload", 0 },
		{ "TroubleShooting", 0 },
		{ "Health", 0 },
		{ "Vitality", 0 },
		{ "Metabolism", 0 },
		{ "Immunity", 0 },
		{ "Intellect", 0 },
		{ "Attention", 0 },
		{ "Shotgun", 0 },
		{ "HMG", 0 },
		{ "Launcher", 0 },
		{ "DMR", 0 },
		{ "AimDrills", 0 },
		{ "Surgery", 0 },
		{ "CovertMovement", 0 },
		{ "Search", 0 },
		{ "FieldMedicine", 0 },
		{ "FirstAid", 0 },
		{ "SMG", 0 },
		{ "WeaponTreatment", 0 },
		{ "Revolver", 0 },
		{ "AttachedLauncher", 0 }
	};

	private Item item;

	private ItemPresetManager presetManager = new ItemPresetManager();

	private bool saveFlag;

	private Item item12;

	private Dictionary<string, string> traderIDs = new Dictionary<string, string>
	{
		{ "Prapor", "54cb50c76803fa8b248b4571" },
		{ "Therapist", "54cb57776803fa99248b456e" },
		{ "Fence", "579dc571d53a0658a154fbec" },
		{ "Skier", "58330581ace78e27b8b10cee" },
		{ "Peacekeeper", "5935c25fb3acc3127c3d8cd9" },
		{ "Mechanic", "5a7c2eca46aef81a7ca2145d" },
		{ "Ragman", "5ac3b934156ae10c4430e83c" },
		{ "Jaeger", "5c0647fdd443bc2504c2d371" },
		{ "Lighthouse Keeper", "638f541a29ffd1183d187f57" }
	};

	public static Dictionary<string, (Func<Color> getColor, Action<Color> setColor, string description, ColorCategory category)> ColorDictionary = new Dictionary<string, (Func<Color>, Action<Color>, string, ColorCategory)>
	{
		{
			"SuperrareColor",
			(() => Settings.SuperrareColor, delegate(Color value)
			{
				Settings.SuperrareColor = value;
			}, "Super rare items Color", ColorCategory.ItemESP)
		},
		{
			"KappaColor",
			(() => Settings.KappaColor, delegate(Color value)
			{
				Settings.KappaColor = value;
			}, "Kappa items Color", ColorCategory.ItemESP)
		},
		{
			"QuestItemColor",
			(() => Settings.QuestItemColor, delegate(Color value)
			{
				Settings.QuestItemColor = value;
			}, "Quest items Color", ColorCategory.ItemESP)
		},
		{
			"StimItemColor",
			(() => Settings.StimItemColor, delegate(Color value)
			{
				Settings.StimItemColor = value;
			}, "Stim items Color", ColorCategory.ItemESP)
		},
		{
			"HideoutColor",
			(() => Settings.HideoutColor, delegate(Color value)
			{
				Settings.HideoutColor = value;
			}, "Hideout items Color", ColorCategory.ItemESP)
		},
		{
			"WishlistColor",
			(() => Settings.WishlistColor, delegate(Color value)
			{
				Settings.WishlistColor = value;
			}, "Wishlist items Color", ColorCategory.ItemESP)
		},
		{
			"SearchedColor",
			(() => Settings.SearchedColor, delegate(Color value)
			{
				Settings.SearchedColor = value;
			}, "Searched items Color", ColorCategory.ItemESP)
		},
		{
			"CommonItemColor",
			(() => Settings.CommonItemColor, delegate(Color value)
			{
				Settings.CommonItemColor = value;
			}, "Common items Color", ColorCategory.ItemESP)
		},
		{
			"USECColor",
			(() => Settings.USECColor, delegate(Color value)
			{
				Settings.USECColor = value;
			}, "USEC Color ", ColorCategory.ESP)
		},
		{
			"BEARColor",
			(() => Settings.BEARColor, delegate(Color value)
			{
				Settings.BEARColor = value;
			}, "BEAR Color", ColorCategory.ESP)
		},
		{
			"BossColor",
			(() => Settings.BossandGuardColor, delegate(Color value)
			{
				Settings.BossandGuardColor = value;
			}, "Bosses Color", ColorCategory.ESP)
		},
		{
			"GuardColor",
			(() => Settings.GuardColor, delegate(Color value)
			{
				Settings.GuardColor = value;
			}, "Guard Color", ColorCategory.ESP)
		},
		{
			"ScavColor",
			(() => Settings.ScavColor, delegate(Color value)
			{
				Settings.ScavColor = value;
			}, "Scav Color", ColorCategory.ESP)
		},
		{
			"ZombieColor",
			(() => Settings.ZombieColor, delegate(Color value)
			{
				Settings.ZombieColor = value;
			}, "Zombie Color", ColorCategory.ESP)
		},
		{
			"RogueColor",
			(() => Settings.RogueColor, delegate(Color value)
			{
				Settings.RogueColor = value;
			}, "Rogue Color", ColorCategory.ESP)
		},
		{
			"RaiderColor",
			(() => Settings.RaiderColor, delegate(Color value)
			{
				Settings.RaiderColor = value;
			}, "Raider Color", ColorCategory.ESP)
		},
		{
			"CultistColor",
			(() => Settings.CultistColor, delegate(Color value)
			{
				Settings.CultistColor = value;
			}, "Cultist Color", ColorCategory.ESP)
		},
		{
			"BTRColor",
			(() => Settings.BTRColor, delegate(Color value)
			{
				Settings.BTRColor = value;
			}, "BTR", ColorCategory.ESP)
		},
		{
			"ESPBoxColor",
			(() => Settings.ESPBoxColor, delegate(Color value)
			{
				Settings.ESPBoxColor = value;
			}, "Box ESP Hidden", ColorCategory.ESP)
		},
		{
			"ESPBoxVisColor",
			(() => Settings.boxsightline, delegate(Color value)
			{
				Settings.boxsightline = value;
			}, "Box ESP Visible", ColorCategory.ESP)
		},
		{
			"ESPLineColor",
			(() => Settings.ESPLineColor, delegate(Color value)
			{
				Settings.ESPLineColor = value;
			}, "Line ESP Hidden", ColorCategory.ESP)
		},
		{
			"ESPLineColorVisible",
			(() => Settings.isvisibleline, delegate(Color value)
			{
				Settings.isvisibleline = value;
			}, "Line ESP Visible", ColorCategory.ESP)
		},
		{
			"SkeletonColor",
			(() => Settings.SkeletonColor, delegate(Color value)
			{
				Settings.SkeletonColor = value;
			}, "Skeleton ESP Color", ColorCategory.ESP)
		},
		{
			"EnemyWeaponTextColor",
			(() => Settings.EnemyWeaponTextColor, delegate(Color value)
			{
				Settings.EnemyWeaponTextColor = value;
			}, "Enemy Weapon Text", ColorCategory.ESP)
		},
		{
			"EnemyWeaponAMMOTextColor",
			(() => Settings.EnemyAmmoCounterColor, delegate(Color value)
			{
				Settings.EnemyAmmoCounterColor = value;
			}, "Enemy Ammo Count", ColorCategory.ESP)
		},
		{
			"EnemyHealingTextColor",
			(() => Settings.healingcolor, delegate(Color value)
			{
				Settings.healingcolor = value;
			}, "Enemy Healing Indicator", ColorCategory.ESP)
		},
		{
			"TeammateColor",
			(() => Settings.teammatecolor, delegate(Color value)
			{
				Settings.teammatecolor = value;
			}, "Teammate Color", ColorCategory.ESP)
		},
		{
			"PlayerScavColor",
			(() => Settings.playerscavcolor, delegate(Color value)
			{
				Settings.playerscavcolor = value;
			}, "Player Scav Color", ColorCategory.ESP)
		},
		{
			"Selected Entity Color",
			(() => Settings.SelectedEntityColor, delegate(Color value)
			{
				Settings.SelectedEntityColor = value;
			}, "Selected Entity Color", ColorCategory.ESP)
		},
		{
			"CrosshairColor",
			(() => Settings.CrosshairColor, delegate(Color value)
			{
				Settings.CrosshairColor = value;
			}, "Crosshair Color", ColorCategory.Aimbot)
		},
		{
			"TargetSnaplineColor",
			(() => Settings.TargetSnaplineColor, delegate(Color value)
			{
				Settings.TargetSnaplineColor = value;
			}, "Aim Target snapline Color", ColorCategory.Aimbot)
		},
		{
			"AimFOVColor",
			(() => Settings.AimFOVColor, delegate(Color value)
			{
				Settings.AimFOVColor = value;
			}, "Aim FOV circle Color", ColorCategory.Aimbot)
		},
		{
			"AmmoCounterColor",
			(() => Settings.AmmoCounterColor, delegate(Color value)
			{
				Settings.AmmoCounterColor = value;
			}, "Ammo counter Color", ColorCategory.Aimbot)
		},
		{
			"TracerColor",
			(() => Settings.TracerColor, delegate(Color value)
			{
				Settings.TracerColor = value;
			}, "Tracers Color", ColorCategory.Aimbot)
		},
		{
			"HitmarkerHeadShotColor",
			(() => Settings.HitmarkerHeadShotColor, delegate(Color value)
			{
				Settings.HitmarkerHeadShotColor = value;
			}, "Hitmarker for headshots Color", ColorCategory.Aimbot)
		},
		{
			"HitmarkerHitColor",
			(() => Settings.HitmarkerHitColor, delegate(Color value)
			{
				Settings.HitmarkerHitColor = value;
			}, "Hitmarker for hits Color", ColorCategory.Aimbot)
		},
		{
			"ExfilColor",
			(() => Settings.ExfilESPColor, delegate(Color value)
			{
				Settings.ExfilESPColor = value;
			}, "Exfil Point Color", ColorCategory.ESP)
		},
		{
			"TransitColor",
			(() => Settings.TransitPointColor, delegate(Color value)
			{
				Settings.TransitPointColor = value;
			}, "Transit Point Color", ColorCategory.ESP)
		},
		{
			"PChamsHidden",
			(() => Settings.PlayerChamsHidden, delegate(Color value)
			{
				Settings.PlayerChamsHidden = value;
			}, "Player Chams Hidden", ColorCategory.Chams)
		},
		{
			"PChamsVisible",
			(() => Settings.PlayerChamsVisible, delegate(Color value)
			{
				Settings.PlayerChamsVisible = value;
			}, "Player Chams Visible", ColorCategory.Chams)
		},
		{
			"GChamsHidden",
			(() => Settings.GrenadeHidden, delegate(Color value)
			{
				Settings.GrenadeHidden = value;
			}, "Grenade Chams Hidden", ColorCategory.Chams)
		},
		{
			"GChamsVisible",
			(() => Settings.GrenadeVisible, delegate(Color value)
			{
				Settings.GrenadeVisible = value;
			}, "Grenade Chams Visible", ColorCategory.Chams)
		},
		{
			"TChamsHidden",
			(() => Settings.TripwireHidden, delegate(Color value)
			{
				Settings.TripwireHidden = value;
			}, "Tripwire Chams Hidden", ColorCategory.Chams)
		},
		{
			"TChamsVisible",
			(() => Settings.TripwireVisible, delegate(Color value)
			{
				Settings.TripwireVisible = value;
			}, "Tripwire Chams Visible", ColorCategory.Chams)
		},
		{
			"SChamsColor",
			(() => Settings.SelfChamsColor, delegate(Color value)
			{
				Settings.SelfChamsColor = value;
			}, "Self Chams Color", ColorCategory.Chams)
		}
	};

	public static Player selectedEntity;

	private Dictionary<string, GameObject> activeEntityButtons = new Dictionary<string, GameObject>();

	private void Start()
	{
		questModule = UnityEngine.Object.FindObjectOfType<QuestModule>();
		aILister = UnityEngine.Object.FindObjectOfType<AILister>();
		pullItemPresets = UnityEngine.Object.FindObjectOfType<PullItemPresets>();
		pullItemIDs = UnityEngine.Object.FindObjectOfType<PullItemIDs>();
		itembuttontemplate.SetActive(value: false);
		PopulateRaidSettingsDropdowns();
		LoadSettings();
		Initialize();
		if (menu != null)
		{
			Canvas component = menu.GetComponent<Canvas>();
			if (component != null)
			{
				component.sortingOrder = 32767;
			}
			CanvasGroup component2 = menu.GetComponent<CanvasGroup>();
			if (component2 != null)
			{
				component2.blocksRaycasts = component2.alpha > 0f;
				component2.ignoreParentGroups = false;
				component2.interactable = true;
			}
			menuBar.SetActive(value: false);
			watermark.SetActive(value: false);
			watermarkmagicbullet.SetActive(value: false);
			helppanel.SetActive(value: false);
			updatepanel.SetActive(value: true);
		}
		if (searchItemInputField != null)
		{
			searchItemInputField.onEndEdit.AddListener(OnSearchItemInputEndEdit);
			searchItemInputField.onValueChanged.AddListener(OnSearchItemValueChanged);
		}
		if (TPItemInputField != null)
		{
			TPItemInputField.onEndEdit.AddListener(TPItemInputEndEdit);
			TPItemInputField.onValueChanged.AddListener(TPItemValueChanged);
		}
		if (closeupdatebutton != null)
		{
			closeupdatebutton.onClick.AddListener(UpdateWindow);
		}
		if (openhelpbutton != null)
		{
			openhelpbutton.onClick.AddListener(ShowHelpPanel);
		}
		if (closehelpbutton != null)
		{
			closehelpbutton.onClick.AddListener(HideHelpPanel);
		}
		if (Refresh != null)
		{
			Refresh.onClick.AddListener(Refreshsearchupdate);
		}
		if (addtowishlist != null)
		{
			addtowishlist.onClick.AddListener(AddItemToWishList);
		}
		clearCacheKeyButton.onClick.AddListener(delegate
		{
			OnKeybindButtonClick(KeybindType.ClearCache);
		});
		skillKeyButton.onClick.AddListener(delegate
		{
			OnKeybindButtonClick(KeybindType.Skill);
		});
		aimbotKeyButton.onClick.AddListener(delegate
		{
			OnKeybindButtonClick(KeybindType.Aimbot);
		});
		unlockDoorsKeyButton.onClick.AddListener(delegate
		{
			OnKeybindButtonClick(KeybindType.UnlockDoors);
		});
		teleportitembutton.onClick.AddListener(delegate
		{
			OnKeybindButtonClick(KeybindType.teleportitem);
		});
		killallbutton.onClick.AddListener(delegate
		{
			OnKeybindButtonClick(KeybindType.killall);
		});
		tpallkeybutton.onClick.AddListener(delegate
		{
			OnKeybindButtonClick(KeybindType.tpall);
		});
		instahealkeybutton.onClick.AddListener(delegate
		{
			OnKeybindButtonClick(KeybindType.instaheal);
		});
		speedhacktogglekeybutton1.onClick.AddListener(delegate
		{
			OnKeybindButtonClick(KeybindType.speedhack);
		});
		flyhacktogglekeybutton1.onClick.AddListener(delegate
		{
			OnKeybindButtonClick(KeybindType.flyhack);
		});
		applyTraderrepButton.onClick.AddListener(OnApplyButtonClick);
		applyTransitButton.onClick.AddListener(OnApplyTransitButtonClick);
		senditemsTransitButton.onClick.AddListener(OnSendItemsTransitButtonClick);
		canceltransitbutton.onClick.AddListener(OnCancelCountdownClick);
		if (traderreputationSlider != null)
		{
			traderreputationSlider.value = Settings.reptoadd;
			traderreputationSlider.onValueChanged.AddListener(OnSliderValueChanged);
		}
		MaxWeaponSkills.onClick.AddListener(MaxWeaponskill);
		redSlider.onValueChanged.AddListener(OnColorSliderValueChanged);
		blueSlider.onValueChanged.AddListener(OnColorSliderValueChanged);
		greenSlider.onValueChanged.AddListener(OnColorSliderValueChanged);
		InitializeColorSliders();
		categoryDropdown.ClearOptions();
		categoryDropdown.AddOptions(Enum.GetNames(typeof(ColorCategory)).ToList());
		categoryDropdown.onValueChanged.AddListener(delegate
		{
			OnCategoryDropdownChanged();
		});
		PopulateColorList();
		colorSettingMenu.SetActive(value: false);
		CancelColorButton.onClick.AddListener(OnCancelColorChangeClick);
		applyColorButton.onClick.AddListener(OnApplyColorButtonClick);
		killEntityButton.onClick.AddListener(OnKillEntityClick);
		tpEntityToCrosshairButton.onClick.AddListener(OnTeleportEntityClick);
		healEntityButton.onClick.AddListener(OnHealEntityClick);
		makebraindeadbutton.onClick.AddListener(onmakebraindeadclick);
		GiveBotBlickyKit.onClick.AddListener(ongivebotblickykitclick);
		GiveAllBotsBlickyKitButton.onClick.AddListener(ongiveallbotsblickykitclick);
		PopulateTraderList();
		PopulateSkillList();
		PopulateAIMenu();
		skillLevelSlider.onValueChanged.AddListener(OnSkillLevelSliderValueChanged);
		applySkillButton.onClick.AddListener(OnApplySkillButtonClick);
		skillLevelSlider.value = 0f;
		skillLevelToAddText.text = $"Level to Set: {skillLevelSlider.value:F0}";
		spawnpresetitembutton.onClick.AddListener(SpawnTemplateDelegate);
		saveToFileButton.onClick.AddListener(delegate
		{
			OpenPopupSaveFile();
		});
		saveToPresetListButton.onClick.AddListener(delegate
		{
			OpenPopupSaveList();
		});
		confirmSaveButton.onClick.AddListener(OnConfirmSave);
		cancelSaveButton.onClick.AddListener(delegate
		{
			popupWindow.SetActive(value: false);
		});
		popupWindow.SetActive(value: false);
		InitializeAimboneDropdown();
		UpdateAimbotSettingsUI();
		UpdatePlayerESPSettingsUI();
		UpdateItemESPSettingsUI();
		UpdateMiscOptionsSettingsUI();
		AddToggleListeners();
		AddSliderListeners();
		advancedItemPanel.SetActive(value: false);
		OpenADvancedItemSpawningButton.onClick.AddListener(Spawnitemadvanced);
	}

	private void LoadSettings()
	{
		UpdateAimbotSettingsUI();
		UpdatePlayerESPSettingsUI();
		UpdateItemESPSettingsUI();
		UpdateMiscOptionsSettingsUI();
	}

	private void SaveSettings()
	{
		Settings.SaveSettings();
	}

	public void Initialize()
	{
		if (aimbotButton != null)
		{
			aimbotButton.onClick.AddListener(ShowAimbotPanel);
		}
		if (playerESPButton != null)
		{
			playerESPButton.onClick.AddListener(ShowPlayerESPPanel);
		}
		if (itemESPButton != null)
		{
			itemESPButton.onClick.AddListener(ShowItemESPPanel);
		}
		if (miscOptionsButton != null)
		{
			miscOptionsButton.onClick.AddListener(ShowMiscOptionsPanel);
		}
		if (settingsButton != null)
		{
			settingsButton.onClick.AddListener(ShowSettingsPanel);
		}
		if (spawnitembutton != null)
		{
			spawnitembutton.onClick.AddListener(OnSpawnItemButtonClick);
		}
		if (saveprimaryweapon != null)
		{
			saveprimaryweapon.onClick.AddListener(SavePrimaryWeaponToJson);
		}
		if (loadfromfilebutton != null)
		{
			loadfromfilebutton.onClick.AddListener(LoadandSpawnitem);
		}
		if (spawnbossbutton != null)
		{
			spawnbossbutton.onClick.AddListener(SpawnBot);
		}
		if (addxpsessionbutton != null)
		{
			addxpsessionbutton.onClick.AddListener(XPAdder);
		}
		if (completequestbutton != null)
		{
			completequestbutton.onClick.AddListener(FinishQuestsWrapper);
		}
		if (searchInputField != null)
		{
			searchInputField.onEndEdit.AddListener(OnSearchTextChanged);
		}
		if (searchInputFieldTemplates != null)
		{
			searchInputFieldTemplates.onEndEdit.AddListener(OnTemplateSearchTextChanged);
		}
		if (aiSearchBar != null)
		{
			aiSearchBar.onEndEdit.AddListener(OnAISearchTextChanged);
		}
		HideAllPanels();
		UpdateKeybindLabels();
	}

	private void Update()
	{
		if (!updatep)
		{
			return;
		}
		try
		{
			if (!populatedTransits && LocationsFixerV2.transitPoints.Count > 0 && Main.GameWorld != null && transitButtonTemplate != null)
			{
				populatedTransits = true;
				PopulateTransitList();
			}
			if (populatedTransits && Main.GameWorld == null)
			{
				populatedTransits = false;
			}
			if (LocationsFixerV2.transitPoints.Count == 0 && transitButtonContainer.childCount >= 1 && transitButtonTemplate != null && transitButtonContainer != null)
			{
				PopulateTransitList();
			}
			if (Main.GamePlayers.Count > 0 && entityButtonTemplate != null)
			{
				UpdateEntityList();
			}
			if (Main.GamePlayers.Count == 0 && entityButtonContainer.childCount >= 1 && entityButtonTemplate != null && entityButtonContainer != null)
			{
				UpdateEntityList();
			}
			if (closedupdate && watermark != null && watermarkmagicbullet != null)
			{
				if (Settings.MagicBullet && Settings.drawwatermark)
				{
					watermark.SetActive(value: false);
					watermarkmagicbullet.SetActive(value: true);
				}
				else if (Settings.drawwatermark)
				{
					watermark.SetActive(value: true);
					watermarkmagicbullet.SetActive(value: false);
				}
				else
				{
					watermark.SetActive(value: false);
					watermarkmagicbullet.SetActive(value: false);
				}
			}
			if (Input.GetKeyDown(KeyCode.Insert) && showmenu)
			{
				if (menuBar != null)
				{
					menuBar.SetActive(!menuBar.activeSelf);
				}
				ClearButtons();
			}
			if (Settings.sicc)
			{
				Settings.ammobox = false;
			}
			if (Settings.ammobox)
			{
				Settings.sicc = false;
			}
			if (Settings.fillraidbp)
			{
				Settings.thicc = false;
			}
			if (Settings.thicc)
			{
				Settings.fillraidbp = false;
			}
			UpdateAimbotSettingsUI();
			UpdatePlayerESPSettingsUI();
			UpdateItemESPSettingsUI();
			UpdateMiscOptionsSettingsUI();
			if (showmenu)
			{
				if (itemspawnpanel != null && Settings.Itemspawnmenu)
				{
					if (Settings.showraidsettingsmenu)
					{
						Settings.showraidsettingsmenu = false;
						itemspawnpanel.SetActive(value: true);
					}
					else
					{
						itemspawnpanel.SetActive(value: true);
					}
				}
				else if (itemspawnpanel != null)
				{
					itemspawnpanel.SetActive(value: false);
				}
				if (aispawnpanel != null && Settings.Itemspawnmenu)
				{
					aispawnpanel.SetActive(value: true);
				}
				else if (aispawnpanel != null)
				{
					aispawnpanel.SetActive(value: false);
				}
				if (traderreppanel != null && Settings.Itemspawnmenu)
				{
					traderreppanel.SetActive(value: true);
				}
				else if (traderreppanel != null)
				{
					traderreppanel.SetActive(value: false);
				}
				if (skillspanel != null && Settings.Itemspawnmenu)
				{
					skillspanel.SetActive(value: true);
				}
				else if (skillspanel != null)
				{
					skillspanel.SetActive(value: false);
				}
				if (presetsPanel != null && Settings.Itemspawnmenu)
				{
					presetsPanel.SetActive(value: true);
				}
				else if (presetsPanel != null)
				{
					presetsPanel.SetActive(value: false);
				}
				if (MainColorSettingsMenu != null && Settings.ShowColorSettingsMenu)
				{
					MainColorSettingsMenu.SetActive(value: true);
					if (Settings.Itemspawnmenu && !hidspawnmenuforcolor)
					{
						hidspawnmenuforcolor = true;
						Settings.Itemspawnmenu = false;
					}
				}
				else if (MainColorSettingsMenu != null)
				{
					MainColorSettingsMenu.SetActive(value: false);
					if (!Settings.Itemspawnmenu && hidspawnmenuforcolor)
					{
						hidspawnmenuforcolor = false;
						Settings.Itemspawnmenu = true;
					}
				}
				if (TransitPanel != null && Settings.showraidsettingsmenu)
				{
					if (Settings.Itemspawnmenu)
					{
						Settings.Itemspawnmenu = false;
						TransitPanel.SetActive(value: true);
						RaidSettingsPanel.SetActive(value: true);
						EntityPanel.SetActive(value: true);
					}
					else
					{
						TransitPanel.SetActive(value: true);
						RaidSettingsPanel.SetActive(value: true);
						EntityPanel.SetActive(value: true);
					}
				}
				else if (TransitPanel != null)
				{
					TransitPanel.SetActive(value: false);
					RaidSettingsPanel.SetActive(value: false);
					EntityPanel.SetActive(value: false);
				}
			}
			if (waitingForKey && Input.anyKeyDown)
			{
				foreach (KeyCode value in Enum.GetValues(typeof(KeyCode)))
				{
					if (Input.GetKeyDown(value))
					{
						AssignKeybind(value);
						break;
					}
				}
				waitingForKey = false;
			}
			if (!populatedtemplates)
			{
				PopulateAllTemplates();
			}
			if (Settings.modifyraidsettings)
			{
				ApplyRaidSettings();
			}
		}
		catch (Exception)
		{
		}
	}

	public void UpdateWindow()
	{
		closedupdate = true;
		updatepanel.SetActive(value: false);
		menuBar.SetActive(value: true);
		menu.SetActive(value: true);
		aimbotPanel.SetActive(value: true);
		if (Settings.MagicBullet)
		{
			watermarkmagicbullet.SetActive(value: true);
		}
		else
		{
			watermark.SetActive(value: true);
		}
		showmenu = true;
	}

	public void ShowHelpPanel()
	{
		showhelp = true;
		if (helppanel != null && showhelp)
		{
			menuBar.SetActive(value: false);
			helppanel.SetActive(value: true);
		}
	}

	public void HideHelpPanel()
	{
		showhelp = false;
		if (helppanel != null && !showhelp)
		{
			menuBar.SetActive(value: true);
			helppanel.SetActive(value: false);
		}
	}

	public void XPAdder()
	{
		if (!(Main.GameWorld = null))
		{
			int num = (int)Settings.expamount;
			Main.LocalPlayer.Profile.EftStats.SessionCounters.SetLong(num, CounterTag.Exp);
			ConsoleScreen.Log("patchedxp");
		}
	}

	public void NullifyRiskyCounters()
	{
		long value = 0L;
		Main.LocalPlayer.Profile.EftStats.SessionCounters.SetLong(value, CounterTag.Money, ECurrencyType.RUB);
		Main.LocalPlayer.Profile.EftStats.SessionCounters.SetLong(value, CounterTag.Keys);
		Main.LocalPlayer.Profile.EftStats.SessionCounters.SetLong(value, CounterTag.Money, ECurrencyType.EUR);
		Main.LocalPlayer.Profile.EftStats.SessionCounters.SetLong(value, CounterTag.Money, ECurrencyType.USD);
	}

	public void ShowAimbotPanel()
	{
		HideAllPanels();
		aimbotPanel.SetActive(value: true);
	}

	public void ShowPlayerESPPanel()
	{
		HideAllPanels();
		playerESPPanel.SetActive(value: true);
	}

	public void ShowItemESPPanel()
	{
		HideAllPanels();
		itemESPPanel.SetActive(value: true);
	}

	public void ShowMiscOptionsPanel()
	{
		HideAllPanels();
		miscOptionsPanel.SetActive(value: true);
	}

	private void FinishQuestsWrapper()
	{
		questModule.FinishQuests();
	}

	public void ShowSettingsPanel()
	{
		HideAllPanels();
		settingsPanel.SetActive(value: true);
	}

	public void LoadandSpawnitem()
	{
		LoadAndSpawnItemFromJson();
	}

	private void OnSearchTextChanged(string searchTerm)
	{
		if (debounceCoroutine != null)
		{
			StopCoroutine(debounceCoroutine);
		}
		debounceCoroutine = StartCoroutine(DebounceUpdateSearchResults(searchTerm));
	}

	public void SpawnTemplateDelegate()
	{
		if (spawnDebounceCoroutine != null)
		{
			StopCoroutine(spawnDebounceCoroutine);
		}
		spawnDebounceCoroutine = StartCoroutine(DebounceSpawnSelectedPreset());
	}

	private IEnumerator DebounceSpawnSelectedPreset()
	{
		yield return new WaitForSeconds(0.1f);
		SpawnSelectedPreset();
	}

	public void OnTemplateSearchTextChanged(string searchText)
	{
		if (searchDebounceCoroutine != null)
		{
			StopCoroutine(searchDebounceCoroutine);
		}
		searchDebounceCoroutine = StartCoroutine(DebounceUpdateSearchText(searchText));
	}

	public void OnAISearchTextChanged(string searchText)
	{
		if (aisearchDebounceCoroutine != null)
		{
			StopCoroutine(aisearchDebounceCoroutine);
		}
		aisearchDebounceCoroutine = StartCoroutine(DebounceAISearchText(searchText));
	}

	private IEnumerator DebounceUpdateSearchText(string searchTerm)
	{
		yield return new WaitForSeconds(0.1f);
		UpdatePresetResults(searchTerm);
	}

	private IEnumerator DebounceAISearchText(string searchTerm)
	{
		yield return new WaitForSeconds(0.1f);
		UpdateAIResults(searchTerm);
	}

	private void ClearButtons()
	{
		foreach (Transform item in buttonContainer)
		{
			UnityEngine.Object.Destroy(item.gameObject);
		}
	}

	private void ClearPresetButtons()
	{
		foreach (Transform item in presetButtonContainer)
		{
			UnityEngine.Object.Destroy(item.gameObject);
		}
	}

	private void OnSpawnItemButtonClick()
	{
		if (newDebounceCoroutine != null)
		{
			StopCoroutine(newDebounceCoroutine);
		}
		newDebounceCoroutine = StartCoroutine(HandleDebouncedEvent());
	}

	private IEnumerator HandleDebouncedEvent()
	{
		yield return new WaitForSeconds(newDebounceTime);
		SpawnItemHelper();
	}

	private IEnumerator DebounceUpdateSearchResults(string searchTerm)
	{
		yield return new WaitForSeconds(debounceTime);
		UpdateSearchResults(searchTerm);
	}

	private void InitializeColorSliders()
	{
		redSlider.minValue = 0f;
		redSlider.maxValue = 1f;
		greenSlider.minValue = 0f;
		greenSlider.maxValue = 1f;
		blueSlider.minValue = 0f;
		blueSlider.maxValue = 1f;
		redSlider.onValueChanged.AddListener(OnColorSliderValueChanged);
		greenSlider.onValueChanged.AddListener(OnColorSliderValueChanged);
		blueSlider.onValueChanged.AddListener(OnColorSliderValueChanged);
	}

	private void PopulateColorList()
	{
		foreach (Transform item2 in colorButtonContainer)
		{
			UnityEngine.Object.Destroy(item2.gameObject);
		}
		ColorCategory value = (ColorCategory)categoryDropdown.value;
		foreach (KeyValuePair<string, (Func<Color>, Action<Color>, string, ColorCategory)> item3 in ColorDictionary)
		{
			string colorName = item3.Key;
			Color color = item3.Value.Item1();
			string item = item3.Value.Item3;
			if (item3.Value.Item4 != value)
			{
				continue;
			}
			GameObject gameObject = UnityEngine.Object.Instantiate(colorButtonTemplate, colorButtonContainer);
			if (gameObject == null)
			{
				continue;
			}
			TMP_Text componentInChildren = gameObject.GetComponentInChildren<TMP_Text>();
			if (componentInChildren != null)
			{
				componentInChildren.text = item ?? "";
			}
			Image componentInChildren2 = gameObject.GetComponentInChildren<Image>();
			if (componentInChildren2 != null)
			{
				componentInChildren2.color = color;
			}
			Button component = gameObject.GetComponent<Button>();
			if (component != null)
			{
				component.onClick.AddListener(delegate
				{
					OnColorButtonClick(colorName);
				});
			}
			gameObject.SetActive(value: true);
		}
		LayoutRebuilder.ForceRebuildLayoutImmediate(colorButtonContainer.GetComponent<RectTransform>());
	}

	private void OnColorButtonClick(string colorKey)
	{
		selectedColorKey = colorKey;
		Color color = ColorDictionary[colorKey].getColor();
		string item = ColorDictionary[colorKey].description;
		redSlider.value = color.r;
		greenSlider.value = color.g;
		blueSlider.value = color.b;
		colorPreview.color = color;
		colorNameText.text = "Editing: \n" + item;
		colorSettingMenu.SetActive(value: true);
	}

	public void OnColorSliderValueChanged(float value)
	{
		colorPreview.color = new Color(redSlider.value, greenSlider.value, blueSlider.value, 1f);
	}

	public void OnApplyColorButtonClick()
	{
		try
		{
			if (!string.IsNullOrEmpty(selectedColorKey))
			{
				Color color = new Color(redSlider.value, greenSlider.value, blueSlider.value);
				if (ColorDictionary.ContainsKey(selectedColorKey))
				{
					ColorDictionary[selectedColorKey].setColor(color);
					ConsoleScreen.Log($"Saving color for {selectedColorKey}: {color}");
				}
				Settings.SaveSettings();
				colorSettingMenu.SetActive(value: false);
				selectedColorKey = null;
				colorNameText.text = "Please Select A Colour To Change";
				PopulateColorList();
			}
		}
		catch (Exception ex)
		{
			ConsoleScreen.Log(ex.Message + " \n " + ex.StackTrace);
		}
	}

	public void OnCancelColorChangeClick()
	{
		colorSettingMenu.SetActive(value: false);
		selectedColorKey = null;
		colorNameText.text = "Please Select A Colour To Change";
		PopulateColorList();
	}

	public void OnCategoryDropdownChanged()
	{
		PopulateColorList();
	}

	public void PopulateTransitList()
	{
		try
		{
			ConsoleScreen.Log("Repopulating Transit List...");
			foreach (Transform item in transitButtonContainer)
			{
				UnityEngine.Object.Destroy(item.gameObject);
			}
			if (LocationsFixerV2.transitPoints.Count > 0)
			{
				notransitstexttmp.text = " ";
			}
			else
			{
				notransitstexttmp.text = "No Transits to List";
			}
			transitInfoText.text = "Please Select A Transit from the List";
			selectedTransitId = -1;
			foreach (TransitPoint transitPoint in LocationsFixerV2.transitPoints)
			{
				if (transitPoint == null || transitPoint.name == null || transitPoint.parameters == null)
				{
					continue;
				}
				GameObject gameObject = UnityEngine.Object.Instantiate(transitButtonTemplate, transitButtonContainer);
				if (gameObject == null)
				{
					continue;
				}
				TMP_Text componentInChildren = gameObject.GetComponentInChildren<TMP_Text>();
				if (componentInChildren != null)
				{
					componentInChildren.text = RemoveUnderscores(transitPoint.name.Transliterate()) ?? "";
				}
				Button component = gameObject.GetComponent<Button>();
				if (component != null)
				{
					int id = transitPoint.parameters.id;
					string name = RemoveUnderscores(transitPoint.name.Transliterate());
					component.onClick.AddListener(delegate
					{
						OnTransitButtonClick(id, name);
					});
				}
				gameObject.SetActive(value: true);
			}
			LayoutRebuilder.ForceRebuildLayoutImmediate(transitButtonContainer.GetComponent<RectTransform>());
			transitScrollRect.verticalNormalizedPosition = 1f;
			Canvas.ForceUpdateCanvases();
		}
		catch (Exception arg)
		{
			ConsoleScreen.Log($"Error in Populate Transit list  :  {arg}");
		}
	}

	private string RemoveUnderscores(string input)
	{
		return input.Replace("_", " ");
	}

	private void OnTransitButtonClick(int id, string name)
	{
		selectedTransitId = id;
		transitInfoText.text = $"Selected Transit Point:\nName: {name}\nID: {id}";
	}

	public void OnApplyTransitButtonClick()
	{
		if (selectedTransitId == -1)
		{
			ConsoleScreen.Log("[TRANSIT] No transit point selected.");
		}
		else
		{
			LocationsFixerV2.StartTransitByID(selectedTransitId);
		}
	}

	public void OnSendItemsTransitButtonClick()
	{
		if (selectedTransitId == -1)
		{
			ConsoleScreen.Log("[TRANSIT ITEMS] No transit point selected.");
		}
		else
		{
			LocationsFixerV2.TransferItemsFromTempStash(selectedTransitId);
		}
	}

	public void OnCancelCountdownClick()
	{
		LocationsFixerV2.StopTransitCountdown();
	}

	private void PopulateTraderList()
	{
		foreach (KeyValuePair<string, string> trader in traderIDs)
		{
			GameObject gameObject = UnityEngine.Object.Instantiate(itembuttontemplate, traderbuttonContainer);
			if (gameObject == null)
			{
				continue;
			}
			TMP_Text componentInChildren = gameObject.GetComponentInChildren<TMP_Text>();
			if (componentInChildren != null)
			{
				componentInChildren.text = trader.Key;
			}
			Button component = gameObject.GetComponent<Button>();
			if (component != null)
			{
				component.onClick.AddListener(delegate
				{
					OnTraderButtonClick(trader.Key, trader.Value);
				});
			}
			gameObject.SetActive(value: true);
		}
		LayoutRebuilder.ForceRebuildLayoutImmediate(traderbuttonContainer.GetComponent<RectTransform>());
		traderscrollRect.verticalNormalizedPosition = 1f;
		Canvas.ForceUpdateCanvases();
	}

	private void OnTraderButtonClick(string traderName, string traderId)
	{
		selectedTraderId = traderId;
		Player localPlayer = Main.LocalPlayer;
		if (!(localPlayer == null))
		{
			if (localPlayer.Profile.TradersInfo.TryGetValue(selectedTraderId, out var value))
			{
				traderinfotext.text = $"Trader Info\nSelected Trader: {traderName}\nCurrent Rep Value: {value.Standing:F2}";
				traderreptoaddvalue.text = $"Value to Add: {Settings.reptoadd:F2}";
			}
			else
			{
				traderinfotext.text = "Trader Info\nSelected Trader: " + traderName + "\nCurrent Rep Value: N/A";
				traderreptoaddvalue.text = $"Value to Add: {Settings.reptoadd:F2}";
			}
		}
	}

	private void OnApplyButtonClick()
	{
		if (!string.IsNullOrEmpty(selectedTraderId))
		{
			Player localPlayer = Main.LocalPlayer;
			if (!(localPlayer == null) && localPlayer.Profile.TradersInfo.TryGetValue(selectedTraderId, out var value))
			{
				float num = (float)(value.Standing + (double)Settings.reptoadd);
				value.SetStanding(num);
				OnTraderButtonClick(GetTraderNameById(selectedTraderId), selectedTraderId);
			}
		}
	}

	private string GetTraderNameById(string traderId)
	{
		foreach (KeyValuePair<string, string> traderID in traderIDs)
		{
			if (traderID.Value == traderId)
			{
				return traderID.Key;
			}
		}
		return "Unknown Trader";
	}

	private void OnSliderValueChanged(float value)
	{
		Settings.reptoadd = value;
		traderreptoaddvalue.text = $"Value to Add: {Settings.reptoadd:F2}";
	}

	private void OnSkillLevelSliderValueChanged(float value)
	{
		skillLevelToAddText.text = $"Level to Set: {value:F0}";
	}

	private void PopulateSkillList()
	{
		foreach (string skill in skillLevels.Keys)
		{
			GameObject gameObject = UnityEngine.Object.Instantiate(itembuttontemplate, skillButtonContainer);
			if (gameObject == null)
			{
				continue;
			}
			TMP_Text componentInChildren = gameObject.GetComponentInChildren<TMP_Text>();
			if (componentInChildren != null)
			{
				componentInChildren.text = skill;
			}
			Button component = gameObject.GetComponent<Button>();
			if (component != null)
			{
				component.onClick.AddListener(delegate
				{
					OnSkillButtonClick(skill);
				});
			}
			gameObject.SetActive(value: true);
		}
		LayoutRebuilder.ForceRebuildLayoutImmediate(skillButtonContainer.GetComponent<RectTransform>());
		skillScrollRect.verticalNormalizedPosition = 1f;
		Canvas.ForceUpdateCanvases();
	}

	private void OnApplySkillButtonClick()
	{
		if (string.IsNullOrEmpty(selectedSkillName))
		{
			return;
		}
		Player localPlayer = Main.LocalPlayer;
		if (!(localPlayer == null))
		{
			int num = (int)skillLevelSlider.value;
			switch (selectedSkillName)
			{
			case "Strength":
				localPlayer.Skills.Strength.SetLevel(num);
				break;
			case "StressResistance":
				localPlayer.Skills.StressResistance.SetLevel(num);
				break;
			case "MagDrills":
				localPlayer.Skills.MagDrills.SetLevel(num);
				break;
			case "Melee":
				localPlayer.Skills.Melee.SetLevel(num);
				break;
			case "HideoutManagement":
				localPlayer.Skills.HideoutManagement.SetLevel(num);
				break;
			case "Crafting":
				localPlayer.Skills.Crafting.SetLevel(num);
				break;
			case "HeavyVests":
				localPlayer.Skills.HeavyVests.SetLevel(num);
				break;
			case "LightVests":
				localPlayer.Skills.LightVests.SetLevel(num);
				break;
			case "RecoilControl":
				localPlayer.Skills.RecoilControl.SetLevel(num);
				break;
			case "LMG":
				localPlayer.Skills.LMG.SetLevel(num);
				break;
			case "Assault":
				localPlayer.Skills.Assault.SetLevel(num);
				break;
			case "Pistol":
				localPlayer.Skills.Pistol.SetLevel(num);
				break;
			case "Perception":
				localPlayer.Skills.Perception.SetLevel(num);
				break;
			case "Sniper":
				localPlayer.Skills.Sniper.SetLevel(num);
				break;
			case "Sniping":
				localPlayer.Skills.Sniping.SetLevel(num);
				break;
			case "Endurance":
				localPlayer.Skills.Endurance.SetLevel(num);
				break;
			case "Throwing":
				localPlayer.Skills.Throwing.SetLevel(num);
				break;
			case "Charisma":
				localPlayer.Skills.Charisma.SetLevel(num);
				break;
			case "BotReload":
				localPlayer.Skills.BotReload.SetLevel(num);
				break;
			case "TroubleShooting":
				localPlayer.Skills.TroubleShooting.SetLevel(num);
				break;
			case "Health":
				localPlayer.Skills.Health.SetLevel(num);
				break;
			case "Vitality":
				localPlayer.Skills.Vitality.SetLevel(num);
				break;
			case "Metabolism":
				localPlayer.Skills.Metabolism.SetLevel(num);
				break;
			case "Immunity":
				localPlayer.Skills.Immunity.SetLevel(num);
				break;
			case "Intellect":
				localPlayer.Skills.Intellect.SetLevel(num);
				break;
			case "Attention":
				localPlayer.Skills.Attention.SetLevel(num);
				break;
			case "Shotgun":
				localPlayer.Skills.Shotgun.SetLevel(num);
				break;
			case "HMG":
				localPlayer.Skills.HMG.SetLevel(num);
				break;
			case "Launcher":
				localPlayer.Skills.Launcher.SetLevel(num);
				break;
			case "DMR":
				localPlayer.Skills.DMR.SetLevel(num);
				break;
			case "AimDrills":
				localPlayer.Skills.AimDrills.SetLevel(num);
				break;
			case "Surgery":
				localPlayer.Skills.Surgery.SetLevel(num);
				break;
			case "CovertMovement":
				localPlayer.Skills.CovertMovement.SetLevel(num);
				break;
			case "Search":
				localPlayer.Skills.Search.SetLevel(num);
				break;
			case "FieldMedicine":
				localPlayer.Skills.FieldMedicine.SetLevel(num);
				break;
			case "FirstAid":
				localPlayer.Skills.FirstAid.SetLevel(num);
				break;
			case "SMG":
				localPlayer.Skills.SMG.SetLevel(num);
				break;
			case "WeaponTreatment":
				localPlayer.Skills.WeaponTreatment.SetLevel(num);
				break;
			case "Revolver":
				localPlayer.Skills.Revolver.SetLevel(num);
				break;
			case "AttachedLauncher":
				localPlayer.Skills.AttachedLauncher.SetLevel(num);
				break;
			}
			skillLevels[selectedSkillName] = num;
		}
	}

	private void OnSkillButtonClick(string skillName)
	{
		selectedSkillName = skillName;
		Player localPlayer = Main.LocalPlayer;
		if (!(localPlayer == null))
		{
			int num = 0;
			num = skillName switch
			{
				"Strength" => localPlayer.Skills.Strength.Level, 
				"StressResistance" => localPlayer.Skills.StressResistance.Level, 
				"MagDrills" => localPlayer.Skills.MagDrills.Level, 
				"Melee" => localPlayer.Skills.Melee.Level, 
				"HideoutManagement" => localPlayer.Skills.HideoutManagement.Level, 
				"Crafting" => localPlayer.Skills.Crafting.Level, 
				"HeavyVests" => localPlayer.Skills.HeavyVests.Level, 
				"LightVests" => localPlayer.Skills.LightVests.Level, 
				"RecoilControl" => localPlayer.Skills.RecoilControl.Level, 
				"LMG" => localPlayer.Skills.LMG.Level, 
				"Assault" => localPlayer.Skills.Assault.Level, 
				"Pistol" => localPlayer.Skills.Pistol.Level, 
				"Perception" => localPlayer.Skills.Perception.Level, 
				"Sniper" => localPlayer.Skills.Sniper.Level, 
				"Sniping" => localPlayer.Skills.Sniping.Level, 
				"Endurance" => localPlayer.Skills.Endurance.Level, 
				"Throwing" => localPlayer.Skills.Throwing.Level, 
				"Charisma" => localPlayer.Skills.Charisma.Level, 
				"BotReload" => localPlayer.Skills.BotReload.Level, 
				"TroubleShooting" => localPlayer.Skills.TroubleShooting.Level, 
				"Health" => localPlayer.Skills.Health.Level, 
				"Vitality" => localPlayer.Skills.Vitality.Level, 
				"Metabolism" => localPlayer.Skills.Metabolism.Level, 
				"Immunity" => localPlayer.Skills.Immunity.Level, 
				"Intellect" => localPlayer.Skills.Intellect.Level, 
				"Attention" => localPlayer.Skills.Attention.Level, 
				"Shotgun" => localPlayer.Skills.Shotgun.Level, 
				"HMG" => localPlayer.Skills.HMG.Level, 
				"Launcher" => localPlayer.Skills.Launcher.Level, 
				"DMR" => localPlayer.Skills.DMR.Level, 
				"AimDrills" => localPlayer.Skills.AimDrills.Level, 
				"Surgery" => localPlayer.Skills.Surgery.Level, 
				"CovertMovement" => localPlayer.Skills.CovertMovement.Level, 
				"Search" => localPlayer.Skills.Search.Level, 
				"FieldMedicine" => localPlayer.Skills.FieldMedicine.Level, 
				"FirstAid" => localPlayer.Skills.FirstAid.Level, 
				"SMG" => localPlayer.Skills.SMG.Level, 
				"WeaponTreatment" => localPlayer.Skills.WeaponTreatment.Level, 
				"Revolver" => localPlayer.Skills.Revolver.Level, 
				"AttachedLauncher" => localPlayer.Skills.AttachedLauncher.Level, 
				_ => 0, 
			};
			skillInfoText.text = $"Selected Skill: {selectedSkillName}\nCurrent Level: {num}";
			skillLevelToAddText.text = $"Level to Set: {skillLevelSlider.value:F0}";
			skillLevelSlider.value = num;
		}
	}

	private void AddItemToWishList()
	{
		Main.GetWishlistItems();
		_E8D9 obj = Main.LocalPlayer.Profile?.WishlistManager;
		if (obj != null)
		{
			if (spawnid != null)
			{
				obj.AddToWishlist(itemidstring, EWishlistGroup.Other, simulate: false);
			}
			Refreshsearchupdate();
		}
	}

	private void PopulateAndFilterItemList(string searchTerm = "")
	{
		if (pullItemIDs == null || pullItemIDs.itemList == null)
		{
			return;
		}
		ClearButtons();
		VerticalLayoutGroup component = buttonContainer.GetComponent<VerticalLayoutGroup>();
		if (component != null)
		{
			component.enabled = false;
			component.enabled = true;
		}
		List<ItemData> itemList = pullItemIDs.itemList;
		bool anyFilterSelected = Settings.filtersuperrare || Settings.filterkappa || Settings.filterquest || Settings.filterwishlist || Settings.filterhideout || Settings.filterstim;
		foreach (ItemData item in itemList.Where(delegate(ItemData itemData)
		{
			bool flag = stupid.solutions.QuestESP.QuestItemIds.Contains(itemData.Name);
			bool flag2 = Main.IsSuperrare(itemData.Name);
			bool flag3 = Main.IsKappa(itemData.Name);
			bool flag4 = Main.IsStim(itemData.Name);
			bool flag5 = Main.wishlistitemids.Contains(itemData.Id);
			bool flag6 = Main.hideoutitemids.Contains(itemData.Id);
			bool flag7 = !anyFilterSelected;
			if (Settings.filtersuperrare && flag2)
			{
				flag7 = true;
			}
			if (Settings.filterkappa && flag3)
			{
				flag7 = true;
			}
			if (Settings.filterquest && flag)
			{
				flag7 = true;
			}
			if (Settings.filterwishlist && flag5)
			{
				flag7 = true;
			}
			if (Settings.filterhideout && flag6)
			{
				flag7 = true;
			}
			if (Settings.filterstim && flag4)
			{
				flag7 = true;
			}
			int? itemPriceBYID2 = GameUtils.GetItemPriceBYID(itemData.Id);
			if (Settings.filtervalue && (!itemPriceBYID2.HasValue || itemPriceBYID2.Value < Settings.moneyfiltervalue))
			{
				return false;
			}
			return (string.IsNullOrEmpty(searchTerm) || itemData.ShortName.Contains(searchTerm) || itemData.Name.Contains(searchTerm) || itemData.Id.Contains(searchTerm)) && flag7;
		}).ToList())
		{
			int? itemPriceBYID = GameUtils.GetItemPriceBYID(item.Id);
			GameObject gameObject = UnityEngine.Object.Instantiate(itembuttontemplate, buttonContainer);
			if (gameObject == null)
			{
				continue;
			}
			TMP_Text componentInChildren = gameObject.GetComponentInChildren<TMP_Text>();
			if (componentInChildren != null)
			{
				if (!Main.wishlistitemids.Contains(item.Id))
				{
					if (!Settings.filtervalue)
					{
						componentInChildren.text = item.ShortName;
					}
					else
					{
						componentInChildren.text = $"{item.ShortName} - {itemPriceBYID / 1000}K";
					}
				}
				else if (!Settings.filtervalue)
				{
					componentInChildren.text = item.ShortName ?? "";
					componentInChildren.color = Color.magenta;
				}
				else
				{
					componentInChildren.text = $"{item.ShortName} - {itemPriceBYID / 1000}K";
					componentInChildren.color = Color.magenta;
				}
			}
			Button component2 = gameObject.GetComponent<Button>();
			if (component2 != null)
			{
				component2.onClick.AddListener(delegate
				{
					SpawnItemDelegate(item.Id, item.Name, item.avg24hPrice, item.BasePrice);
				});
			}
			gameObject.SetActive(value: true);
		}
		LayoutRebuilder.ForceRebuildLayoutImmediate(buttonContainer.GetComponent<RectTransform>());
		scrollRect.verticalNormalizedPosition = 1f;
		Canvas.ForceUpdateCanvases();
	}

	private void UpdateSearchResults(string searchTerm)
	{
		PopulateAndFilterItemList(searchTerm);
	}

	private void Refreshsearchupdate()
	{
		string searchTerm = "";
		if (searchInputField.text != null)
		{
			searchTerm = searchInputField.text;
		}
		PopulateAndFilterItemList(searchTerm);
	}

	public void PopulateAllTemplates()
	{
		if (itembuttontemplate == null || pullItemPresets == null || pullItemPresets.templateList == null || pullItemPresets.templateList.Count == 0)
		{
			return;
		}
		populatedtemplates = true;
		ClearButtons();
		foreach (Transform item in presetButtonContainer)
		{
			UnityEngine.Object.Destroy(item.gameObject);
		}
		VerticalLayoutGroup component = presetButtonContainer.GetComponent<VerticalLayoutGroup>();
		if (component != null)
		{
			component.enabled = false;
			component.enabled = true;
		}
		foreach (TemplateData template in pullItemPresets.templateList)
		{
			GameObject gameObject = UnityEngine.Object.Instantiate(itembuttontemplate, presetButtonContainer);
			if (gameObject == null)
			{
				continue;
			}
			TMP_Text componentInChildren = gameObject.GetComponentInChildren<TMP_Text>();
			if (componentInChildren != null)
			{
				componentInChildren.text = template.PresetName;
			}
			Button component2 = gameObject.GetComponent<Button>();
			if (component2 != null)
			{
				component2.onClick.AddListener(delegate
				{
					SelectPreset(template.PresetName, template.ItemTemplate.FirstOrDefault().Value.Description);
				});
			}
			gameObject.SetActive(value: true);
		}
		LayoutRebuilder.ForceRebuildLayoutImmediate(presetButtonContainer.GetComponent<RectTransform>());
		presetScrollRect.verticalNormalizedPosition = 1f;
		Canvas.ForceUpdateCanvases();
	}

	private void UpdatePresetResults(string searchTerm)
	{
		if (pullItemPresets == null || pullItemPresets.templateList == null)
		{
			return;
		}
		if (string.IsNullOrEmpty(searchTerm))
		{
			PopulateAllTemplates();
			return;
		}
		ClearPresetButtons();
		VerticalLayoutGroup component = presetButtonContainer.GetComponent<VerticalLayoutGroup>();
		if (component != null)
		{
			component.enabled = false;
			component.enabled = true;
		}
		List<TemplateData> list = pullItemPresets.templateList.Where((TemplateData templateData) => templateData.PresetName.Contains(searchTerm)).ToList();
		if (pullItemPresets.templateList == null)
		{
			ConsoleScreen.Log("template list is null");
		}
		foreach (TemplateData template in list)
		{
			GameObject gameObject = UnityEngine.Object.Instantiate(itembuttontemplate, presetButtonContainer);
			if (gameObject == null)
			{
				continue;
			}
			TMP_Text componentInChildren = gameObject.GetComponentInChildren<TMP_Text>();
			if (componentInChildren != null)
			{
				componentInChildren.text = template.PresetName;
			}
			Button component2 = gameObject.GetComponent<Button>();
			if (component2 != null)
			{
				component2.onClick.AddListener(delegate
				{
					SelectPreset(template.PresetName, template.ItemTemplate.FirstOrDefault().Value.Description);
				});
			}
			gameObject.SetActive(value: true);
		}
		LayoutRebuilder.ForceRebuildLayoutImmediate(presetButtonContainer.GetComponent<RectTransform>());
		presetScrollRect.verticalNormalizedPosition = 1f;
		Canvas.ForceUpdateCanvases();
	}

	private void SelectPreset(string presetName, string description)
	{
		selectedPresetName = presetName;
		ConsoleScreen.Log("Selected preset: " + presetName);
		presetInfoText.text = " Selected preset : " + presetName + "\n Description : " + description;
	}

	public unsafe async Task SpawnSelectedPreset()
	{
		if (string.IsNullOrEmpty(selectedPresetName) || pullItemPresets == null || pullItemPresets.templateList == null)
		{
			ConsoleScreen.Log("No preset selected or presets list is empty.");
			return;
		}
		TemplateData templateData = pullItemPresets.templateList.FirstOrDefault((TemplateData template) => template.PresetName == selectedPresetName);
		if (templateData == null)
		{
			ConsoleScreen.Log("Selected preset not found in the list.");
			return;
		}
		ConsoleScreen.Log("Spawning preset: " + templateData.PresetName);
		KeyValuePair<string, stupid.solutions.ItemTemplate> keyValuePair = templateData.ItemTemplate.FirstOrDefault();
		if (keyValuePair.Value == null)
		{
			ConsoleScreen.Log("No item template found for the selected preset.");
			return;
		}
		string key = keyValuePair.Key;
		Dictionary<string, stupid.solutions.SlotData> slotsDictionary = keyValuePair.Value.Slots;
		ItemFactory itemFactory = new ItemFactory();
		dynamic item = itemFactory.CreateItem(key);
		if (item == null)
		{
			ConsoleScreen.Log("Failed to create the main item from the template.");
			return;
		}
		item.SpawnedInSession = true;
		dynamic val = item.AllSlots;
		if (val != null)
		{
			foreach (dynamic item3 in val)
			{
				string text = item3.FullId;
				if (slotsDictionary.TryGetValue(text, out var value))
				{
					string itemId = value.ItemId;
					Item item2 = itemFactory.CreateItem(itemId);
					item2.SpawnedInSession = true;
					if (item2 != null)
					{
						try
						{
							item3.AddWithoutRestrictions(item2);
							ConsoleScreen.Log("Added component item " + itemId + " to slot '" + text + "'.");
						}
						catch (Exception ex)
						{
							ConsoleScreen.Log("Error adding component to slot '" + text + "': " + ex.Message);
						}
					}
					else
					{
						ConsoleScreen.Log("Failed to create component item with ID " + itemId + ".");
					}
				}
				await Task.Delay(10);
			}
		}
		else
		{
			ConsoleScreen.Log("No slots found for the main item.");
		}
		dynamic awaiter = AddItemToBackpack(item).GetAwaiter();
		if (!(bool)awaiter.IsCompleted)
		{
			ICriticalNotifyCompletion awaiter2 = awaiter as ICriticalNotifyCompletion;
			AsyncTaskMethodBuilder asyncTaskMethodBuilder = default(AsyncTaskMethodBuilder);
			if (awaiter2 == null)
			{
				INotifyCompletion awaiter3 = (INotifyCompletion)(object)awaiter;
				asyncTaskMethodBuilder.AwaitOnCompleted(ref awaiter3, ref *(_003CSpawnSelectedPreset_003Ed__388*)/*Error near IL_06ed: stateMachine*/);
			}
			else
			{
				asyncTaskMethodBuilder.AwaitUnsafeOnCompleted(ref awaiter2, ref *(_003CSpawnSelectedPreset_003Ed__388*)/*Error near IL_0700: stateMachine*/);
			}
			/*Error near IL_0709: leave MoveNext - await not detected correctly*/;
		}
		awaiter.GetResult();
	}

	private void SpawnItemDelegate(string itemId, string fullname, int? value, int basevalue)
	{
		itemidstring = itemId;
		string text = ((!value.HasValue) ? $"Value: {basevalue / 1000}K" : $"Value: {value / 1000}K");
		iteminfotext.text = "Selected Item Info :\nFull Name : " + fullname + "\nItem ID: " + itemId + "\n" + text;
	}

	private void UpdateAIResults(string searchTerm)
	{
		if (string.IsNullOrEmpty(searchTerm))
		{
			PopulateAIMenu();
		}
		else
		{
			if (aILister.aiPresets == null)
			{
				return;
			}
			ClearAIButtons();
			VerticalLayoutGroup component = aiButtonContainer.GetComponent<VerticalLayoutGroup>();
			if (component != null)
			{
				component.enabled = false;
				component.enabled = true;
			}
			foreach (AIData ai in aILister.aiPresets.Where((AIData aIData) => aIData.Name.Contains(searchTerm)).ToList())
			{
				GameObject gameObject = UnityEngine.Object.Instantiate(aiButtonTemplate, aiButtonContainer);
				if (gameObject == null)
				{
					continue;
				}
				TMP_Text componentInChildren = gameObject.GetComponentInChildren<TMP_Text>();
				if (componentInChildren != null)
				{
					componentInChildren.text = ai.Name;
					componentInChildren.color = ai.NameColor;
				}
				Button component2 = gameObject.GetComponent<Button>();
				if (component2 != null)
				{
					component2.onClick.AddListener(delegate
					{
						SelectAI(ai.Name, ai.EnumID, ai.Description);
					});
				}
				gameObject.SetActive(value: true);
			}
			LayoutRebuilder.ForceRebuildLayoutImmediate(aiButtonContainer.GetComponent<RectTransform>());
			if (aiScrollRect != null)
			{
				aiScrollRect.verticalNormalizedPosition = 1f;
			}
			Canvas.ForceUpdateCanvases();
		}
	}

	public void PopulateAIMenu()
	{
		if (aILister.aiPresets == null || aILister.aiPresets.Count == 0)
		{
			ConsoleScreen.Log("No AI presets available.");
			return;
		}
		if (aILister.aiPresets.Count > 0)
		{
			ConsoleScreen.Log($"Found {aILister.aiPresets.Count} AI for List");
		}
		ClearAIButtons();
		VerticalLayoutGroup component = aiButtonContainer.GetComponent<VerticalLayoutGroup>();
		if (component != null)
		{
			component.enabled = false;
			component.enabled = true;
		}
		foreach (AIData ai in aILister.aiPresets)
		{
			GameObject gameObject = UnityEngine.Object.Instantiate(aiButtonTemplate, aiButtonContainer);
			if (gameObject == null)
			{
				continue;
			}
			TMP_Text componentInChildren = gameObject.GetComponentInChildren<TMP_Text>();
			if (componentInChildren != null)
			{
				componentInChildren.text = ai.Name;
				componentInChildren.color = ai.NameColor;
			}
			Button component2 = gameObject.GetComponent<Button>();
			if (component2 != null)
			{
				component2.onClick.AddListener(delegate
				{
					SelectAI(ai.Name, ai.EnumID, ai.Description);
				});
			}
			gameObject.SetActive(value: true);
		}
		LayoutRebuilder.ForceRebuildLayoutImmediate(aiButtonContainer.GetComponent<RectTransform>());
		if (aiScrollRect != null)
		{
			aiScrollRect.verticalNormalizedPosition = 1f;
		}
		Canvas.ForceUpdateCanvases();
	}

	private void SelectAI(string aiName, WildSpawnType aiID, string description)
	{
		selectedAIName = aiName;
		spawnid = aiID.ToString();
		aiInfoText.text = "Selected AI: " + aiName + "\nDescription: " + description;
	}

	private void ClearAIButtons()
	{
		foreach (Transform item in aiButtonContainer)
		{
			UnityEngine.Object.Destroy(item.gameObject);
		}
	}

	public void SpawnBot()
	{
		IBotGame instance = Singleton<IBotGame>.Instance;
		string text = spawnid;
		try
		{
			if (instance == null || spawnid == null)
			{
				return;
			}
			if (Enum.TryParse<WildSpawnType>(text, out var result))
			{
				BotSpawnParams botSpawnParams = new BotSpawnParams();
				botSpawnParams.Id_spawn = "";
				if (result == WildSpawnType.infectedAssault || result == WildSpawnType.infectedLaborant || result == WildSpawnType.infectedPmc || result == WildSpawnType.infectedCivil)
				{
					botSpawnParams.TriggerType = SpawnTriggerType.botEvent;
				}
				else
				{
					botSpawnParams.TriggerType = SpawnTriggerType.none;
				}
				instance.BotsController.GetSpawner().SpawnBotByTypeForce(1, result, BotDifficulty.normal, botSpawnParams);
				ConsoleScreen.Log($"Spawned AI: {selectedAIName} ({result})");
			}
			else
			{
				ConsoleScreen.Log("Invalid WildSpawnType: " + text);
			}
		}
		catch (SystemException ex)
		{
			ConsoleScreen.Log("Error spawning Bot " + ex.Message);
		}
	}

	public void SpawnItemHelper()
	{
		if (Settings.fillraidbp)
		{
			FillRaidBag();
		}
		if (Settings.thicc)
		{
			AddItemsToThiccCase();
		}
		else if (Settings.ammobox || Settings.sicc)
		{
			AddItemsToBackpack();
		}
		else
		{
			Spawnitem();
		}
	}

	public void FillRaidBag()
	{
		if (Main.GameWorld == null)
		{
			ConsoleScreen.Log("Log: Game world not found to spawn items in.");
			return;
		}
		try
		{
			ItemFactory itemFactory = new ItemFactory();
			dynamic containedItem = Main.LocalPlayer.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.Backpack).ContainedItem;
			if (containedItem == null)
			{
				Item item = itemFactory.CreateItem("5df8a4d786f77412672a1e3b");
				if (item == null)
				{
					ConsoleScreen.Log("Log: Failed to create backpack.");
					return;
				}
				Main.LocalPlayer.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.Backpack).AddWithoutRestrictions(item);
				containedItem = Main.LocalPlayer.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.Backpack).ContainedItem;
			}
			if (containedItem == null || containedItem.Grids == null || containedItem.Grids.Length == 0)
			{
				ConsoleScreen.Log("Log: No valid grid found in backpack.");
				return;
			}
			dynamic val = containedItem.Grids[0];
			if (!Settings.sicc && !Settings.ammobox && !Settings.thicc)
			{
				for (int i = 0; i < val.GridWidth; i++)
				{
					for (int j = 0; j < val.GridHeight; j++)
					{
						dynamic val2 = itemFactory.CreateItem(itemidstring);
						if (val2 == null)
						{
							ConsoleScreen.Log("Log: Failed to create item with ID " + itemidstring + ".");
							continue;
						}
						val2.SpawnedInSession = true;
						val2.StackObjectsCount = val2.Template.StackMaxSize;
						if (Settings.componentexploit)
						{
							ProcessComponents(val2);
						}
						LocationInGrid locationInGrid = val.FindFreeSpace(val2);
						if (!(locationInGrid != null))
						{
							ConsoleScreen.Log("Log: No free space left in backpack for more items.");
							return;
						}
						val.AddItemWithoutRestrictions(val2, locationInGrid);
					}
				}
			}
			else
			{
				string text = (Settings.sicc ? Settings.SICCID : "5aafbde786f774389d0cbc0f");
				int num = (Settings.sicc ? 1 : 2);
				int num2 = 2;
				int num3 = val.GridWidth;
				int num4 = val.GridHeight;
				int num5 = num3 * num4 / (num * num2);
				for (int k = 0; k < num5; k++)
				{
					dynamic val3 = itemFactory.CreateItem(text);
					if (val3 == null)
					{
						ConsoleScreen.Log("Log: Failed to create container with ID " + text + ".");
						continue;
					}
					val3.SpawnedInSession = true;
					FillContainerWithNestedItems(val3, itemidstring, itemFactory);
					LocationInGrid locationInGrid2 = val.FindFreeSpace(val3);
					if (!(locationInGrid2 != null))
					{
						ConsoleScreen.Log("Log: No free space left in backpack for more containers.");
						break;
					}
					val.AddItemWithoutRestrictions(val3, locationInGrid2);
					ConsoleScreen.Log("Log: Container added to backpack successfully.");
				}
			}
			ConsoleScreen.Log("Log: Backpack filled to maximum capacity.");
		}
		catch (Exception ex)
		{
			ConsoleScreen.Log("Log: Exception occurred while filling backpack: " + ex.Message);
		}
	}

	public void Spawnitemadvanced()
	{
		advanceditemidcache = itemidstring;
		advanceditemcache = new ItemFactory().CreateItem(advanceditemidcache);
		if (advanceditemcache == null)
		{
			ConsoleScreen.Log("Failed to create advanced item.");
			return;
		}
		cachedBuffs = ExtractBuffs(advanceditemcache);
		cachedSlots = ExtractSlots(advanceditemcache);
		ShowAdvancedItemMenu();
	}

	private List<BuffComponent> ExtractBuffs(dynamic item)
	{
		List<BuffComponent> list = new List<BuffComponent>();
		try
		{
			dynamic itemComponents = item.GetItemComponents<BuffComponent>();
			if (itemComponents != null)
			{
				list.AddRange(itemComponents);
			}
		}
		catch
		{
			dynamic itemComponent = item.GetItemComponent<BuffComponent>();
			if (itemComponent != null)
			{
				list.Add(itemComponent);
			}
		}
		return list;
	}

	private List<(string slotName, dynamic slotRef)> ExtractSlots(dynamic item)
	{
		List<(string, object)> list = new List<(string, object)>();
		dynamic val = item.AllSlots;
		if (val != null)
		{
			foreach (dynamic item2 in val)
			{
				if (item2.ContainedItem == null)
				{
					list.Add(((string)(object)item2.Name, item2));
				}
			}
		}
		return list;
	}

	private void RefreshslotItems()
	{
		ConsoleScreen.Log("Updating Items Available Slots...");
		int count = cachedSlots.Count;
		cachedSlots = ExtractSlots(advanceditemcache);
		PopulateSlotListUI(cachedSlots);
		ConsoleScreen.Log($"Item Slots Updated : {count} -> {cachedSlots.Count}");
	}

	private void ShowAdvancedItemMenu()
	{
		advancedItemPanel.SetActive(value: true);
		slotItemWindow.SetActive(value: false);
		PopulateBuffListUI(cachedBuffs);
		PopulateSlotListUI(cachedSlots);
		spawnadvancedButton.onClick.RemoveAllListeners();
		spawnadvancedButton.onClick.AddListener(OnSpawnAdvancedConfirmed);
		cancelButton.onClick.RemoveAllListeners();
		cancelButton.onClick.AddListener(CloseAdvancedSpawnMenuandReset);
		refreshSlotsButton.onClick.RemoveAllListeners();
		refreshSlotsButton.onClick.AddListener(delegate
		{
			RefreshslotItems();
		});
		buffEditWindow.SetActive(cachedBuffs.Count > 0);
		slotListContainer.parent.gameObject.SetActive(cachedSlots.Count > 0);
	}

	private void CloseAdvancedSpawnMenuandReset()
	{
		advancedItemPanel.SetActive(value: false);
		advanceditemcache = null;
		cachedBuffs.Clear();
		cachedSlots.Clear();
		PopulateBuffListUI(cachedBuffs);
		PopulateSlotListUI(cachedSlots);
	}

	private void PopulateBuffListUI(List<BuffComponent> buffs)
	{
		foreach (Transform item in buffListContainer)
		{
			UnityEngine.Object.Destroy(item.gameObject);
		}
		foreach (BuffComponent buff in buffs)
		{
			string buffname = "Empty Buff Slot";
			if (IsValidBuff(buff.BuffType))
			{
				buffname = buff.BuffType.ToString();
			}
			GameObject obj = UnityEngine.Object.Instantiate(buffButtonTemplate, buffListContainer);
			obj.GetComponentInChildren<TMP_Text>().text = $"{buffname} ({buff.Value:F2})";
			obj.GetComponent<Button>().onClick.AddListener(delegate
			{
				OnBuffSelected(buff, buffname);
			});
			obj.SetActive(value: true);
		}
	}

	private bool IsValidBuff(ERepairBuffType type)
	{
		if (Enum.IsDefined(typeof(ERepairBuffType), type))
		{
			return type != (ERepairBuffType)(-1);
		}
		return false;
	}

	private void OnBuffSelected(BuffComponent buff, string buffName)
	{
		currentEditingBuff = buff;
		buffNameText.text = buffName;
		buffSlider.value = (float)buff.Value;
		buffTypeDropdown.ClearOptions();
		List<string> options = Enum.GetNames(typeof(ERepairBuffType)).ToList();
		buffTypeDropdown.AddOptions(options);
		int buffType = (int)buff.BuffType;
		if (buffType >= 0 && buffType < buffTypeDropdown.options.Count)
		{
			buffTypeDropdown.value = buffType;
		}
		UpdateBuffInfoText(buff);
		buffValueText.text = $"Buff Value: {buff.Value:F2}";
		buffSlider.onValueChanged.RemoveAllListeners();
		buffSlider.onValueChanged.AddListener(delegate(float value)
		{
			buffValueText.text = $"Buff Value: {value:F2}";
		});
		applyBuffButton.onClick.RemoveAllListeners();
		applyBuffButton.onClick.AddListener(delegate
		{
			float value = buffSlider.value;
			if (Enum.TryParse<ERepairBuffType>(buffTypeDropdown.options[buffTypeDropdown.value].text, out var result))
			{
				buff.BuffType = result;
			}
			buff.Value = value;
			currentEditingBuff = null;
			buffNameText.text = "Please select a Buff from the List";
			buffValueText.text = "";
			PopulateBuffListUI(cachedBuffs);
		});
	}

	private void DumpAndSetAllAttributes(dynamic item1)
	{
		Item item2 = item1 as Item;
		if (item2.Attributes == null)
		{
			ConsoleScreen.Log("No attributes found.");
			return;
		}
		foreach (_EFA5 attribute in item2.Attributes)
		{
			float num;
			try
			{
				num = ((attribute.Base != null) ? attribute.Base() : float.NaN);
			}
			catch
			{
				num = float.NaN;
			}
			string arg = attribute.DisplayName ?? attribute.Name ?? "Unknown";
			ConsoleScreen.Log($"Attribute: {arg} | Current Value: {num}");
			attribute.Base = () => 1000000f;
			attribute.StringValue = () => "1000000";
			attribute.Update();
		}
		ConsoleScreen.Log("All attribute Base values replaced with 1,000,000.");
	}

	private void UpdateBuffInfoText(BuffComponent buff)
	{
		buffNameText.text = $"Buff: {buff.BuffType}";
		buffValueText.text = $"Buff Value: {buff.Value:F2}";
	}

	private void PopulateSlotListUI(List<(string, dynamic)> slots)
	{
		foreach (Transform item in slotListContainer)
		{
			UnityEngine.Object.Destroy(item.gameObject);
		}
		foreach (var slot in slots)
		{
			string slotName = slot.Item1;
			dynamic slotRef = slot.Item2;
			GameObject obj = UnityEngine.Object.Instantiate(slotButtonTemplate, slotListContainer);
			obj.GetComponentInChildren<TMP_Text>().text = slotName;
			obj.GetComponent<Button>().onClick.AddListener(delegate
			{
				OpenSlotSelectWindow(slotRef, slotName);
			});
			obj.SetActive(value: true);
		}
	}

	private void OpenSlotSelectWindow(dynamic slot, string slotName)
	{
		currentEditingSlotRef = slot;
		currentSlotName = slotName;
		selectedSlotItemId = null;
		if (!slotItemWindow.activeSelf)
		{
			slotItemWindow.SetActive(value: true);
		}
		slotItemWindowTitle.text = "Slot: " + slotName;
		slotItemInfoText.text = "Select an item...";
		try
		{
			foreach (Transform item2 in slotCompatibleItemsContainer)
			{
				UnityEngine.Object.Destroy(item2.gameObject);
			}
		}
		catch (Exception arg)
		{
			ConsoleScreen.Log($"[AdvancedItemSpawner] Instance Clearing Error: {arg}");
		}
		List<ItemData> list = new List<ItemData>();
		try
		{
			if (slot.Filters != null)
			{
				foreach (dynamic item3 in slot.Filters)
				{
					dynamic val = item3 == null;
					if (val || item3.Filter == null)
					{
						continue;
					}
					foreach (object item4 in item3.Filter)
					{
						try
						{
							string text = ((dynamic)item4)?.ToString()?.Trim();
							if (!string.IsNullOrEmpty(text) && text.Length == 24)
							{
								ItemData itemDataByID = GetItemDataByID(text);
								list.Add(itemDataByID);
							}
						}
						catch (Exception)
						{
						}
					}
				}
			}
			else
			{
				ConsoleScreen.Log("[AdvancedItemSpawner] Slot '" + slotName + "' has no filters.");
			}
		}
		catch (Exception ex2)
		{
			ConsoleScreen.Log("[AdvancedItemSpawner] ERROR parsing filters: " + ex2.Message + "\n" + ex2.StackTrace);
		}
		if (list.Count == 0)
		{
			slotItemInfoText.text = "No compatible items.";
			ConsoleScreen.Log("[AdvancedItemSpawner] No compatible items for slot '" + slotName + "'.");
			slotItemWindow.SetActive(value: false);
			return;
		}
		ConsoleScreen.Log($"[AdvancedItemSpawner] Found {list.Count} compatible items for slot '{slotName}':");
		foreach (ItemData id in list.Distinct())
		{
			GameObject obj = UnityEngine.Object.Instantiate(compatibleItemButtonTemplate, slotCompatibleItemsContainer);
			obj.GetComponentInChildren<TMP_Text>().text = id.ShortName;
			obj.GetComponent<Button>().onClick.AddListener(delegate
			{
				selectedSlotItemId = id.Id;
				slotItemInfoText.text = "Selected Item Name : " + id.Name + "\nSelected Item ID:" + id.Id;
			});
			obj.SetActive(value: true);
		}
		cancelSlotButton.onClick.RemoveAllListeners();
		cancelSlotButton.onClick.AddListener(delegate
		{
			HideSlotItemWindow();
		});
		applySlotButton.onClick.RemoveAllListeners();
		applySlotButton.onClick.AddListener(delegate
		{
			if (!string.IsNullOrEmpty(selectedSlotItemId))
			{
				try
				{
					Item item = new ItemFactory().CreateItem(selectedSlotItemId);
					if (item != null)
					{
						item.SpawnedInSession = true;
						currentEditingSlotRef.AddWithoutRestrictions(item);
						ConsoleScreen.Log("[AdvancedItemSpawner] Applied item " + selectedSlotItemId + " to slot " + currentSlotName);
						foreach (BuffComponent item5 in ExtractBuffs(item))
						{
							if (!cachedBuffs.Contains(item5))
							{
								cachedBuffs.Add(item5);
							}
						}
						buffEditWindow.SetActive(cachedBuffs.Count > 0);
						PopulateBuffListUI(cachedBuffs);
					}
					else
					{
						ConsoleScreen.Log("[AdvancedItemSpawner] Failed to create item from ID " + selectedSlotItemId);
					}
				}
				catch (Exception ex3)
				{
					ConsoleScreen.Log("[AdvancedItemSpawner] Failed to apply item to slot: " + ex3.Message);
				}
			}
			HideSlotItemWindow();
		});
	}

	private void HideSlotItemWindow()
	{
		RefreshslotItems();
		slotItemWindow.SetActive(value: false);
		selectedSlotItemId = null;
		slotItemInfoText.text = "Select an item...";
	}

	private ItemData GetItemDataByID(string itemID)
	{
		if (pullItemIDs.itemList != null && pullItemIDs.itemList.Count > 0)
		{
			ItemData itemData = pullItemIDs.itemList.FirstOrDefault((ItemData item) => item.Id == itemID);
			if (itemData != null && !string.IsNullOrEmpty(itemData.Name))
			{
				return itemData;
			}
		}
		return new ItemData
		{
			Id = itemID,
			ShortName = "Default Component",
			Name = "Default Component",
			NormalizedName = "default_component",
			Types = new List<string>(),
			BasePrice = 0,
			avg24hPrice = null
		};
	}

	private void OnSpawnAdvancedConfirmed()
	{
		if (advanceditemcache != null)
		{
			AddItemToBackpack(advanceditemcache);
			advancedItemPanel.SetActive(value: false);
			advanceditemcache = null;
			cachedBuffs.Clear();
			cachedSlots.Clear();
			PopulateBuffListUI(cachedBuffs);
			PopulateSlotListUI(cachedSlots);
			ConsoleScreen.Log("Advanced item spawned successfully.");
		}
	}

	private void OpenPopupSaveFile()
	{
		UnityEngine.Debug.Log("Opening popup for save type: " + SaveType.File);
		ConsoleScreen.Log("Opening popup for save type: " + SaveType.File);
		if (popupWindow == null)
		{
			UnityEngine.Debug.LogError("popupWindow is not assigned!");
			ConsoleScreen.Log("Opening popup for save type: " + SaveType.File);
		}
		else if (presetNameInput == null)
		{
			UnityEngine.Debug.LogError("presetNameInput is not assigned!");
			ConsoleScreen.Log("Opening popup for save type: " + SaveType.File);
		}
		else
		{
			currentSaveType = SaveType.File;
			popupWindow.SetActive(value: true);
		}
	}

	private void OpenPopupSaveList()
	{
		UnityEngine.Debug.Log("Opening popup for save type: " + SaveType.List);
		ConsoleScreen.Log("Opening popup for save type: " + SaveType.List);
		if (popupWindow == null)
		{
			UnityEngine.Debug.LogError("popupWindow is not assigned!");
			ConsoleScreen.Log("Opening popup for save type: " + SaveType.List);
		}
		else if (presetNameInput == null)
		{
			UnityEngine.Debug.LogError("presetNameInput is not assigned!");
			ConsoleScreen.Log("Opening popup for save type: " + SaveType.List);
		}
		else
		{
			currentSaveType = SaveType.List;
			popupWindow.SetActive(value: true);
		}
	}

	private void OnConfirmSave()
	{
		string text = presetNameInput.text.Trim();
		if (string.IsNullOrEmpty(text))
		{
			ConsoleScreen.Log("Please enter a name.");
			return;
		}
		if (advanceditemcache == null)
		{
			ConsoleScreen.LogError("No item selected to save.");
			return;
		}
		if (currentSaveType == SaveType.File)
		{
			SaveItemToFile(advanceditemcache, text);
		}
		else
		{
			pullItemPresets.SaveItemToPresetList(advanceditemcache, text);
			PopulateAllTemplates();
		}
		popupWindow.SetActive(value: false);
	}

	public void Spawnitem()
	{
		if (Main.GameWorld == null)
		{
			return;
		}
		try
		{
			ItemFactory itemFactory = new ItemFactory();
			string text = itemidstring;
			dynamic val = itemFactory.CreateItem(text);
			dynamic property = val.GetType().GetProperty("AllSlots");
			if (val == null)
			{
				ConsoleScreen.Log("Log: Failed to create item.");
				return;
			}
			if (property == null)
			{
				ConsoleScreen.Log("Log: Item does not contain a definition for AllSlots. Not attempting to fill.");
			}
			ConsoleScreen.Log("Log: Item created successfully.");
			val.SpawnedInSession = true;
			val.StackObjectsCount = val.Template.StackMaxSize;
			presetManager.itemParameters["ItemId"] = text;
			presetManager.itemParameters["StackMaxSize"] = (object)val.Template.StackMaxSize;
			presetManager.itemParameters["QuestItem"] = (object)val.QuestItem;
			dynamic val2 = ((property != null) ? property.GetValue(val) : null);
			if ((val2 != null) & Settings.fillslots)
			{
				ProcessSlotsForSpawn(val);
			}
			if (Settings.componentexploit)
			{
				ProcessComponents(val);
			}
			AddItemToBackpack(val);
			if (saveFlag)
			{
				string filePath = Path.Combine(Application.persistentDataPath, "itempresets.json");
				presetManager.SaveToJson(filePath);
				presetManager.Clear();
				saveFlag = false;
			}
		}
		catch (Exception ex)
		{
			ConsoleScreen.Log("Log: Exception occurred: " + ex.Message);
		}
	}

	private void ProcessComponents(dynamic item)
	{
		if (item.GetItemComponent<DogtagComponent>() is DogtagComponent dogtagComponent)
		{
			string text = item.Template.Name;
			if (text.Contains("bear") || text.Contains("BEAR") || text.Contains("Bear"))
			{
				dogtagComponent.Side = EPlayerSide.Bear;
			}
			else
			{
				dogtagComponent.Side = EPlayerSide.Usec;
			}
			dogtagComponent.Level = 75;
			dogtagComponent.KillerName = "a Solution by xXBattleyeXx";
			dogtagComponent.WeaponName = "Balls WTF";
			dogtagComponent.Time = DateTime.Now;
			dogtagComponent.CarriedByGroupMember = false;
			dogtagComponent.Nickname = "stupid.solutions";
			dogtagComponent.Item.SpawnedInSession = true;
			dogtagComponent.Status = "My boiiiiiiiiiiiiiiiiiiiiiahahsdgwajh";
		}
		_ = item.GetItemComponent<EquipmentPenaltyComponent>() is EquipmentPenaltyComponent;
		if (item.GetItemComponent<FoodDrinkComponent>() is FoodDrinkComponent foodDrinkComponent)
		{
			foodDrinkComponent.HpPercent = 999999f;
			foodDrinkComponent.Item.SpawnedInSession = true;
		}
		_ = item.GetItemComponent<GridLayoutComponent>() is GridLayoutComponent;
		_ = item.GetItemComponent<StimulatorBuffsComponent>() is StimulatorBuffsComponent;
		if (item.GetItemComponent<KeyComponent>() is KeyComponent keyComponent)
		{
			keyComponent.NumberOfUsages = -100000;
			keyComponent.Item.SpawnedInSession = true;
		}
		if (item.GetItemComponent<KeycardComponent>() is KeycardComponent keycardComponent)
		{
			keycardComponent.Key.NumberOfUsages = -100000;
			keycardComponent.Item.SpawnedInSession = true;
		}
		if (item.GetItemComponent<MedKitComponent>() is MedKitComponent medKitComponent)
		{
			medKitComponent.HpResource = 99999f;
			medKitComponent.Item.SpawnedInSession = true;
		}
		if (item.GetItemComponent<RecodableComponent>() is RecodableComponent recodableComponent)
		{
			recodableComponent.IsEncoded = true;
			recodableComponent.SetEncoded(value: true);
			recodableComponent.Item.SpawnedInSession = true;
		}
		if (item.GetItemComponent<RepairKitComponent>() is RepairKitComponent repairKitComponent)
		{
			repairKitComponent.Resource = 999999f;
			repairKitComponent.Item.SpawnedInSession = true;
		}
		if (item.GetItemComponent<RepairableComponent>() is RepairableComponent repairableComponent)
		{
			repairableComponent.Durability = 999999f;
			repairableComponent.Item.SpawnedInSession = true;
		}
		_ = item.GetItemComponent<SightComponent>() is SightComponent;
		if (item.GetItemComponent<ResourceComponent>() is ResourceComponent resourceComponent)
		{
			resourceComponent.Value = 999999f;
			resourceComponent.Item.SpawnedInSession = true;
		}
	}

	private void ProcessSlotsForSpawn(dynamic item)
	{
		if (!Settings.fillslots)
		{
			return;
		}
		ItemFactory itemFactory = new ItemFactory();
		dynamic val = item.AllSlots;
		if (val == null)
		{
			ConsoleScreen.Log("Log: No slots found for the base item.");
			return;
		}
		foreach (dynamic item3 in val)
		{
			string text = item3.Name;
			string text2 = item3.FullId;
			Dictionary<string, string> value = new Dictionary<string, string>
			{
				{ "SlotID", text2 },
				{ "SlotName", text }
			};
			presetManager.itemParameters[text2] = value;
			dynamic val2 = item3.Filters;
			dynamic val3 = val2 == null;
			if (val3 || val2.Length == 0)
			{
				continue;
			}
			foreach (dynamic item4 in val2)
			{
				val3 = item4 == null || item4.Filter == null;
				if (val3 || item4.Filter.Length == 0)
				{
					continue;
				}
				string text3 = ((item4.Filter.Length == 1) ? item4.Filter[0].ToString() : item4.Filter[UnityEngine.Random.Range(0, item4.Filter.Length)].ToString());
				ConsoleScreen.Log("Log: Slot " + text + " - Selected component item ID: " + text3);
				if (!string.IsNullOrEmpty(text3))
				{
					Item item2 = itemFactory.CreateItem(text3);
					item2.SpawnedInSession = true;
					if (item2 != null)
					{
						item3.AddWithoutRestrictions(item2);
						((Dictionary<string, string>)presetManager.itemParameters[text2])["ItemId"] = text3;
					}
				}
				break;
			}
		}
	}

	public async Task LoadAndSpawnItemFromJson()
	{
		try
		{
			string filePath = Path.Combine(Application.persistentDataPath, "itempresets.json");
			string mainItemId;
			Dictionary<string, Dictionary<string, string>> dictionary = presetManager.LoadFromJson(filePath, out mainItemId);
			if (dictionary == null || string.IsNullOrEmpty(mainItemId))
			{
				return;
			}
			ItemFactory itemFactory = new ItemFactory();
			dynamic item = itemFactory.CreateItem(mainItemId);
			if ((item == null) || !dictionary.TryGetValue("Slots", out var slotsDictionary) || slotsDictionary == null)
			{
				return;
			}
			item.SpawnedInSession = true;
			dynamic val = item.AllSlots;
			if (val == null)
			{
				return;
			}
			foreach (dynamic item3 in val)
			{
				string key = item3.FullId;
				if (slotsDictionary.TryGetValue(key, out var value))
				{
					slotsDictionary.Remove(key);
					Item item2 = itemFactory.CreateItem(value);
					item2.SpawnedInSession = true;
					if (item2 != null)
					{
						try
						{
							item3.AddWithoutRestrictions(item2);
						}
						catch (Exception)
						{
						}
					}
				}
				await Task.Delay(10);
			}
			AddItemToBackpack(item);
		}
		catch (Exception)
		{
		}
	}

	private void SaveItemToFile(dynamic item, string filename)
	{
		Dictionary<string, object> dictionary = new Dictionary<string, object>();
		dictionary.Add(item.TemplateId.ToString(), new Dictionary<string, object>
		{
			{ "StackMaxSize", 1 },
			{ "QuestItem", false },
			{
				"Slots",
				new Dictionary<string, Dictionary<string, string>>()
			}
		});
		Dictionary<string, object> dictionary2 = dictionary;
		Dictionary<string, Dictionary<string, string>> dictionary3 = (Dictionary<string, Dictionary<string, string>>)((Dictionary<string, object>)dictionary2[item.TemplateId.ToString()])["Slots"];
		foreach (dynamic item2 in item.AllSlots)
		{
			if (item2.ContainedItem != null)
			{
				dynamic val = item2.FullId;
				Dictionary<string, string> dictionary4 = new Dictionary<string, string>();
				dictionary4.Add("SlotID", item2.FullId);
				dictionary4.Add("SlotName", item2.Name);
				dictionary4.Add("ItemId", item2.ContainedItem.TemplateId);
				dictionary3[val] = dictionary4;
			}
		}
		string text = Path.Combine(Application.persistentDataPath, filename + ".json");
		File.WriteAllText(text, JsonConvert.SerializeObject(dictionary2, Formatting.Indented));
		ConsoleScreen.Log("Saved to file: " + text);
	}

	public void SavePrimaryWeaponToJson()
	{
		ConsoleScreen.Log("Attempting to save Primary Weapon...");
		try
		{
			dynamic containedItem = Main.LocalPlayer.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.FirstPrimaryWeapon).ContainedItem;
			if (containedItem == null)
			{
				return;
			}
			Dictionary<string, object> dictionary = new Dictionary<string, object>();
			dictionary.Add(containedItem.TemplateId.ToString(), new Dictionary<string, object>
			{
				{ "StackMaxSize", 1 },
				{ "QuestItem", false },
				{
					"Slots",
					new Dictionary<string, Dictionary<string, string>>()
				}
			});
			Dictionary<string, object> dictionary2 = dictionary;
			Dictionary<string, Dictionary<string, string>> dictionary3 = (Dictionary<string, Dictionary<string, string>>)((Dictionary<string, object>)dictionary2[containedItem.TemplateId.ToString()])["Slots"];
			foreach (dynamic item in containedItem.AllSlots)
			{
				if (item.ContainedItem != null)
				{
					dynamic val = item.FullId;
					Dictionary<string, string> dictionary4 = new Dictionary<string, string>();
					dictionary4.Add("SlotID", item.FullId);
					dictionary4.Add("SlotName", item.Name);
					dictionary4.Add("ItemId", item.ContainedItem.TemplateId);
					dictionary3[val] = dictionary4;
				}
			}
			string text = Path.Combine(Application.persistentDataPath, "itempresets.json");
			File.WriteAllText(text, JsonConvert.SerializeObject(dictionary2, Formatting.Indented));
			ConsoleScreen.Log("Saved successfully: " + text);
		}
		catch (Exception ex)
		{
			ConsoleScreen.Log("Exception occurred: " + ex.Message);
		}
	}

	private async Task AddItemToBackpack(dynamic item)
	{
		dynamic containedItem = Main.LocalPlayer.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.Backpack).ContainedItem;
		if (containedItem == null)
		{
			Item item2 = new ItemFactory().CreateItem("5df8a4d786f77412672a1e3b");
			if (item2 != null)
			{
				Main.LocalPlayer.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.Backpack).AddWithoutRestrictions(item2);
				containedItem = Main.LocalPlayer.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.Backpack).ContainedItem;
			}
		}
		if (containedItem != null)
		{
			dynamic val = containedItem.Grids[0].FindFreeSpace(item);
			if (val == null)
			{
				ItemFactory.GridHelper gridHelper = new ItemFactory.GridHelper();
				dynamic val2 = containedItem.Grids[0];
				LocationInGrid locationInGrid = gridHelper.FindFreeSpace(item, val2);
				containedItem.Grids[0].AddItemWithoutRestrictions(item, locationInGrid);
				ConsoleScreen.Log($"using old method =  {locationInGrid}");
			}
			else if (val != null)
			{
				containedItem.Grids[0].AddItemWithoutRestrictions(item, val);
				ConsoleScreen.Log("Item successfully added to the backpack.");
			}
		}
		else
		{
			ConsoleScreen.LogError("No backpack found to place the item.");
		}
	}

	private async Task testgrid()
	{
		dynamic containedItem = Main.LocalPlayer.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.SecuredContainer).ContainedItem;
		if (containedItem == null)
		{
			ItemFactory itemFactory = new ItemFactory();
			Gridmanager gridmanager = new Gridmanager();
			Item item = itemFactory.CreateItem("5c093ca986f7740a1867ab12");
			if (item != null)
			{
				gridmanager.ReplaceGrid(item, 4, 90);
				Main.LocalPlayer.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.SecuredContainer).AddWithoutRestrictions(item);
				containedItem = Main.LocalPlayer.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.SecuredContainer).ContainedItem;
			}
		}
		if (containedItem != null)
		{
			string text = "5c0a794586f77461c458f894";
			Gridmanager gridmanager2 = new Gridmanager();
			gridmanager2.ReplaceGrid(containedItem, 4, 90, text);
		}
	}

	public void AddItemsToThiccCase()
	{
		if (Main.GameWorld == null)
		{
			return;
		}
		try
		{
			ItemFactory itemFactory = new ItemFactory();
			dynamic val = itemFactory.CreateItem("5aafbde786f774389d0cbc0f");
			if (val.GetItemComponent<TagComponent>() is TagComponent tagComponent)
			{
				_ = (string)val.Template.ShortName;
				tagComponent.Name = "Contains THICC";
				tagComponent.Color = 2;
				tagComponent.Item.SpawnedInSession = true;
			}
			dynamic val2 = itemFactory.CreateItem("5c0a840b86f7742ffa4f2482");
			val2.SpawnedInSession = true;
			val.SpawnedInSession = true;
			if (val2 == null)
			{
				ConsoleScreen.Log("Log: Failed to create Thicc case.");
				return;
			}
			dynamic containedItem = Main.LocalPlayer.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.Backpack).ContainedItem;
			if (GameUtils.IsInventoryItemValid(containedItem))
			{
				LocationInGrid locationInGrid = containedItem.Grids[0].FindFreeSpace(val);
				LocationInGrid locationInGrid2 = val.Grids[0].FindFreeSpace(val2);
				if (locationInGrid != null)
				{
					HandleThiccCaseContents(val2, itemFactory);
					val.Grids[0].AddItemWithoutRestrictions(val2, locationInGrid2);
					val.Grids[0].AddItemWithoutRestrictions(val2, locationInGrid2);
					containedItem.Grids[0].AddItemWithoutRestrictions(val, locationInGrid);
					ConsoleScreen.Log("Log: Thicc case added to the backpack successfully.");
				}
				return;
			}
			Item item = itemFactory.CreateItem("5df8a4d786f77412672a1e3b");
			if (item != null)
			{
				Main.LocalPlayer.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.Backpack).AddWithoutRestrictions(item);
				dynamic containedItem2 = Main.LocalPlayer.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.Backpack).ContainedItem;
				LocationInGrid locationInGrid3 = containedItem2.Grids[0].FindFreeSpace(val);
				LocationInGrid locationInGrid4 = val.Grids[0].FindFreeSpace(val2);
				if (containedItem2 != null)
				{
					val.Grids[0].AddItemWithoutRestrictions(val2, locationInGrid4);
					val.Grids[0].AddItemWithoutRestrictions(val2, locationInGrid4);
					containedItem.Grids[0].AddItemWithoutRestrictions(val, locationInGrid3);
				}
			}
		}
		catch (Exception ex)
		{
			ConsoleScreen.Log("Log: Exception occurred: " + ex.Message);
		}
	}

	private void HandleThiccCaseContents(dynamic thiccCase, ItemFactory itemFactory)
	{
		if (Main.GameWorld == null)
		{
			return;
		}
		dynamic val = thiccCase.Grids[0];
		int num = val.GridWidth;
		int num2 = val.GridHeight;
		string id = (Settings.sicc ? Settings.SICCID : "5aafbde786f774389d0cbc0f");
		int num3 = (Settings.sicc ? 1 : 2);
		int num4 = 2;
		int num5 = num * num2 / (num3 * num4);
		for (int i = 0; i < num5; i++)
		{
			dynamic val2 = itemFactory.CreateItem(id);
			if (val2 != null)
			{
				val2.SpawnedInSession = true;
				LocationInGrid locationInGrid = val.FindFreeSpace(val2);
				if (locationInGrid != null)
				{
					val.AddItemWithoutRestrictions(val2, locationInGrid);
					ConsoleScreen.Log("Log: Container added to Thicc case.");
					FillContainerWithNestedItems(val2, itemidstring, itemFactory);
				}
				else
				{
					ConsoleScreen.Log("Log: No free space in Thicc case for container.");
				}
			}
			else
			{
				ConsoleScreen.Log("Log: Failed to create container.");
			}
		}
	}

	public void AddItemsToBackpack()
	{
		if (Main.GameWorld == null)
		{
			return;
		}
		try
		{
			ItemFactory itemFactory = new ItemFactory();
			string id = (Settings.sicc ? Settings.SICCID : "5aafbde786f774389d0cbc0f");
			_ = Settings.sicc;
			dynamic val = itemFactory.CreateItem(id);
			if (val == null)
			{
				ConsoleScreen.Log("Log: Failed to create container.");
				return;
			}
			val.SpawnedInSession = true;
			dynamic containedItem = Main.LocalPlayer.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.Backpack).ContainedItem;
			if (GameUtils.IsInventoryItemValid(containedItem))
			{
				LocationInGrid locationInGrid = containedItem.Grids[0].FindFreeSpace(val);
				if (locationInGrid != null)
				{
					containedItem.Grids[0].AddItemWithoutRestrictions(val, locationInGrid);
					ConsoleScreen.Log("Log: Container added to the backpack successfully.");
					FillContainerWithNestedItems(val, itemidstring, itemFactory);
				}
				else
				{
					ConsoleScreen.Log("Log: No free space in backpack for container.");
				}
			}
			else
			{
				ConsoleScreen.Log("Log: Backpack is not valid.");
			}
		}
		catch (Exception ex)
		{
			ConsoleScreen.Log("Log: Exception occurred: " + ex.Message);
		}
	}

	private void FillContainerWithNestedItems(dynamic container, string nestedItemID, ItemFactory itemFactory)
	{
		if (Main.GameWorld == null)
		{
			return;
		}
		dynamic val = container.Grids[0];
		int num = val.GridWidth;
		int num2 = val.GridHeight;
		int num3 = 1;
		int num4 = 1;
		int num5 = num * num2 / (num3 * num4);
		for (int i = 0; i < num5; i++)
		{
			dynamic val2 = itemFactory.CreateItem(nestedItemID);
			if (val2 != null)
			{
				val2.SpawnedInSession = true;
				val2.StackObjectsCount = val2.Template.StackMaxSize;
				if (container.GetItemComponent<TagComponent>() is TagComponent tagComponent)
				{
					string text = val2.Template.ShortName;
					tagComponent.Name = "Contains " + text + " ";
					tagComponent.Color = 2;
					tagComponent.Item.SpawnedInSession = true;
				}
				if (Settings.componentexploit)
				{
					ProcessComponents(val2);
				}
				LocationInGrid locationInGrid = val.FindFreeSpace(val2);
				if (!(locationInGrid != null))
				{
					ConsoleScreen.Log("Log: No free space in container for nested item.");
					break;
				}
				val.AddItemWithoutRestrictions(val2, locationInGrid);
			}
			else
			{
				ConsoleScreen.Log("Log: Failed to create nested item with ID: " + nestedItemID + ".");
			}
		}
	}

	private void OnKeybindButtonClick(KeybindType keybindType)
	{
		currentKeybindType = keybindType;
		waitingForKey = true;
		switch (keybindType)
		{
		case KeybindType.ClearCache:
			clearCacheKeyLabel.text = "Press a key...";
			break;
		case KeybindType.Skill:
			skillKeyLabel.text = "Press a key...";
			break;
		case KeybindType.Aimbot:
			aimbotKeyLabel.text = "Press a key...";
			break;
		case KeybindType.UnlockDoors:
			unlockDoorsKeyLabel.text = "Press a key...";
			break;
		case KeybindType.teleportitem:
			teleportitemlabel.text = "Press a key...";
			break;
		case KeybindType.killall:
			killalllabel.text = "Press a key...";
			break;
		case KeybindType.tpall:
			tpallkeylabel.text = "Press a key...";
			break;
		case KeybindType.instaheal:
			instahealkeylabel.text = "Press a key...";
			break;
		case KeybindType.flyhack:
			flyhacktogglekeylabel1.text = "Press a key...";
			break;
		case KeybindType.speedhack:
			speedhacktogglekeylabel1.text = "Press a key...";
			break;
		}
	}

	private void AssignKeybind(KeyCode newKey)
	{
		switch (currentKeybindType)
		{
		case KeybindType.ClearCache:
			Settings.ClearCache = newKey;
			clearCacheKeyLabel.text = "Key: " + newKey;
			break;
		case KeybindType.Skill:
			Settings.tpp = newKey;
			skillKeyLabel.text = "Key: " + newKey;
			break;
		case KeybindType.Aimbot:
			Settings.AimbotKey = newKey;
			aimbotKeyLabel.text = "Key: " + newKey;
			break;
		case KeybindType.UnlockDoors:
			Settings.UnlockDoors = newKey;
			unlockDoorsKeyLabel.text = "Key: " + newKey;
			break;
		case KeybindType.teleportitem:
			Settings.teleportitem = newKey;
			teleportitemlabel.text = "Key: " + newKey;
			break;
		case KeybindType.killall:
			Settings.KillAll = newKey;
			killalllabel.text = "Key: " + newKey;
			break;
		case KeybindType.tpall:
			Settings.TPall = newKey;
			tpallkeylabel.text = "Key: " + newKey;
			break;
		case KeybindType.instaheal:
			Settings.Instahealkey = newKey;
			instahealkeylabel.text = "Key: " + newKey;
			break;
		case KeybindType.flyhack:
			Settings.flyhacktoggle = newKey;
			flyhacktogglekeylabel1.text = "Key: " + newKey;
			break;
		case KeybindType.speedhack:
			Settings.speedhacktoggle = newKey;
			speedhacktogglekeylabel1.text = "Key: " + newKey;
			break;
		}
	}

	private void UpdateKeybindLabels()
	{
		clearCacheKeyLabel.text = "Key: " + Settings.ClearCache;
		skillKeyLabel.text = "Key: " + Settings.tpp;
		aimbotKeyLabel.text = "Key: " + Settings.AimbotKey;
		unlockDoorsKeyLabel.text = "Key: " + Settings.UnlockDoors;
		teleportitemlabel.text = "Key: " + Settings.teleportitem;
		killalllabel.text = "Key: " + Settings.KillAll;
		tpallkeylabel.text = "Key: " + Settings.TPall;
		instahealkeylabel.text = "Key: " + Settings.Instahealkey;
		speedhacktogglekeylabel1.text = "Key: " + Settings.speedhacktoggle;
		flyhacktogglekeylabel1.text = "Key: " + Settings.flyhacktoggle;
	}

	public void HideAllPanels()
	{
		aimbotPanel.SetActive(value: false);
		playerESPPanel.SetActive(value: false);
		itemESPPanel.SetActive(value: false);
		miscOptionsPanel.SetActive(value: false);
		settingsPanel.SetActive(value: false);
	}

	public void UpdateAimbotSettingsUI()
	{
		if (aimbotToggle != null)
		{
			aimbotToggle.isOn = Settings.Aimbot;
		}
		if (aimbotSmoothLabel != null)
		{
			aimbotSmoothLabel.text = $"Aimbot Smooth {(int)Settings.AimbotSmooth}";
		}
		if (aimbotSmoothSlider != null)
		{
			aimbotSmoothSlider.value = Settings.AimbotSmooth;
		}
		if (aimbotDrawFOVToggle != null)
		{
			aimbotDrawFOVToggle.isOn = Settings.AimbotDrawFOV;
		}
		if (aimbotFOVLabel != null)
		{
			aimbotFOVLabel.text = $"Aimbot FOV {(int)Settings.AimbotFOV}";
		}
		if (aimbotFOVSlider != null)
		{
			aimbotFOVSlider.value = Settings.AimbotFOV;
		}
		if (noRecoilToggle != null)
		{
			noRecoilToggle.isOn = Settings.NoRecoil;
		}
		if (crosshairToggle != null)
		{
			crosshairToggle.isOn = Settings.Crosshair;
		}
		if (silentAimToggle != null)
		{
			silentAimToggle.isOn = Settings.SilentAim;
		}
		if (silentTargetLinesToggle != null)
		{
			silentTargetLinesToggle.isOn = Settings.SilentTargetLines;
		}
		if (instahitToggle != null)
		{
			instahitToggle.isOn = Settings.instahit;
		}
		if (ammodrawToggle != null)
		{
			ammodrawToggle.isOn = Settings.DrawInfo;
		}
		if (CheckVisibletoggle != null)
		{
			CheckVisibletoggle.isOn = Settings.CheckVisible;
		}
		if (MagicBulletToggle != null)
		{
			MagicBulletToggle.isOn = Settings.MagicBullet;
		}
		if (infiniteammo != null)
		{
			infiniteammo.isOn = Settings.infammo;
		}
		if (tracers != null)
		{
			tracers.isOn = Settings.tracers;
		}
		if (hitmarkers != null)
		{
			hitmarkers.isOn = Settings.HitMarkers;
		}
		if (bulletspershotLabel != null)
		{
			bulletspershotLabel.text = $"Bullets Per Shot {Settings.bulletspershot}";
		}
		if (bulletspershottoggle != null)
		{
			bulletspershottoggle.isOn = Settings.bulletspershottoggle;
		}
		if (bulletspershot != null)
		{
			bulletspershot.value = Settings.bulletspershot;
		}
	}

	public void ApplyAimbotSettingsUI()
	{
		Settings.Aimbot = aimbotToggle.isOn;
		Settings.AimbotSmooth = aimbotSmoothSlider.value;
		Settings.AimbotDrawFOV = aimbotDrawFOVToggle.isOn;
		Settings.AimbotFOV = aimbotFOVSlider.value;
		Settings.NoRecoil = noRecoilToggle.isOn;
		Settings.Crosshair = crosshairToggle.isOn;
		Settings.SilentAim = silentAimToggle.isOn;
		Settings.SilentTargetLines = silentTargetLinesToggle.isOn;
		Settings.instahit = instahitToggle.isOn;
		Settings.DrawInfo = ammodrawToggle.isOn;
		Settings.CheckVisible = CheckVisibletoggle.isOn;
		Settings.MagicBullet = MagicBulletToggle.isOn;
		Settings.infammo = infiniteammo.isOn;
		Settings.tracers = tracers.isOn;
		Settings.HitMarkers = hitmarkers.isOn;
		Settings.bulletspershottoggle = bulletspershottoggle.isOn;
		Settings.bulletspershot = (int)bulletspershot.value;
		SaveSettings();
	}

	private void InitializeAimboneDropdown()
	{
		if (aimboneDropdown != null)
		{
			aimboneDropdown.options.Clear();
			aimboneDropdown.options.Add(new TMP_Dropdown.OptionData("Head"));
			aimboneDropdown.options.Add(new TMP_Dropdown.OptionData("Neck"));
			aimboneDropdown.options.Add(new TMP_Dropdown.OptionData("Body 1"));
			aimboneDropdown.options.Add(new TMP_Dropdown.OptionData("Body 2"));
			SetDropdownValueFromSettings();
			aimboneDropdown.onValueChanged.AddListener(delegate
			{
				AimboneDropdownValueChanged(aimboneDropdown);
			});
		}
	}

	private void SetDropdownValueFromSettings()
	{
		int key = new Dictionary<int, int>
		{
			{ 0, 133 },
			{ 1, 132 },
			{ 2, 36 },
			{ 3, 35 }
		}.FirstOrDefault((KeyValuePair<int, int> x) => x.Value == Settings.Aimbone).Key;
		if (key >= 0 && key < aimboneDropdown.options.Count)
		{
			aimboneDropdown.value = key;
		}
	}

	private void AimboneDropdownValueChanged(TMP_Dropdown dropdown)
	{
		Dictionary<int, int> obj = new Dictionary<int, int>
		{
			{ 0, 133 },
			{ 1, 132 },
			{ 2, 36 },
			{ 3, 35 }
		};
		int value = dropdown.value;
		if (obj.TryGetValue(value, out var value2))
		{
			Settings.Aimbone = value2;
			SaveSettings();
		}
	}

	private void TPItemValueChanged(string input)
	{
		if (!string.IsNullOrWhiteSpace(input))
		{
			TPItemInputstring = input;
		}
	}

	private void TPItemInputEndEdit(string input)
	{
		if (!string.IsNullOrWhiteSpace(input))
		{
			TPItemInputstring = input;
		}
		else
		{
			UnityEngine.Debug.LogWarning("Input is either null or whitespace.");
		}
	}

	public void UpdatePlayerESPSettingsUI()
	{
		if (drawPlayersToggle != null)
		{
			drawPlayersToggle.isOn = Settings.DrawPlayers;
		}
		if (drawPlayerBoxToggle != null)
		{
			drawPlayerBoxToggle.isOn = Settings.DrawPlayerBox;
		}
		if (drawPlayerNameToggle != null)
		{
			drawPlayerNameToggle.isOn = Settings.DrawPlayerName;
		}
		if (drawPlayerLineToggle != null)
		{
			drawPlayerLineToggle.isOn = Settings.DrawPlayerLine;
		}
		if (drawPlayerHealthToggle != null)
		{
			drawPlayerHealthToggle.isOn = Settings.DrawPlayerHealth;
		}
		if (drawWeaponToggle != null)
		{
			drawWeaponToggle.isOn = Settings.playerWeapon;
		}
		if (enableSkeletonToggle != null)
		{
			enableSkeletonToggle.isOn = Settings.EnableSkeleton;
		}
		if (ChamsToggle != null)
		{
			ChamsToggle.isOn = Settings.Chams;
		}
		if (drawRadarToggle != null)
		{
			drawRadarToggle.isOn = Settings.DrawRadar;
		}
		if (drawaimpostoggle != null)
		{
			drawaimpostoggle.isOn = Settings.drawaimpos;
		}
		if (fullbright != null)
		{
			fullbright.isOn = Settings.fullbright;
		}
		if (grenadeesp != null)
		{
			grenadeesp.isOn = Settings.grenadeesp;
		}
		if (DrawTripWires != null)
		{
			DrawTripWires.isOn = Settings.tripwire;
		}
		if (drawPlayersDistanceSlider != null)
		{
			drawPlayersDistanceSlider.value = Settings.DrawPlayersDistance;
		}
		if (drawplayerdistancelabel != null)
		{
			drawplayerdistancelabel.text = $"Player Distance {(int)Settings.DrawPlayersDistance} m";
		}
		if (radardistanceslider != null)
		{
			radardistanceslider.value = Settings.DrawPlayersRadarDistance;
		}
		if (radardistancelabel != null)
		{
			radardistancelabel.text = $"Radar Distance {(int)Settings.DrawPlayersRadarDistance} m";
		}
		if (SkeletonUpdateSlider != null)
		{
			SkeletonUpdateSlider.value = Settings.cachedelayskelet;
		}
		float num = 1f / Settings.cachedelayskelet;
		if (SkeletonUpdateSliderText != null)
		{
			SkeletonUpdateSliderText.text = $"Skeleton Update Speed {num:F2} FPS  ";
		}
		if (FONTSIZE != null)
		{
			FONTSIZE.value = Settings.fontsize;
		}
		if (FONTSIZETXT != null)
		{
			FONTSIZETXT.text = $"ESP Font Size : {Settings.fontsize} ";
		}
	}

	public void ApplyPlayerESPSettingsUI()
	{
		Settings.DrawPlayers = drawPlayersToggle.isOn;
		Settings.DrawPlayerBox = drawPlayerBoxToggle.isOn;
		Settings.DrawPlayerName = drawPlayerNameToggle.isOn;
		Settings.DrawPlayerLine = drawPlayerLineToggle.isOn;
		Settings.DrawPlayerHealth = drawPlayerHealthToggle.isOn;
		Settings.playerWeapon = drawWeaponToggle.isOn;
		Settings.EnableSkeleton = enableSkeletonToggle.isOn;
		Settings.DrawRadar = drawRadarToggle.isOn;
		Settings.DrawPlayersDistance = drawPlayersDistanceSlider.value;
		Settings.DrawPlayersRadarDistance = radardistanceslider.value;
		Settings.cachedelayskelet = SkeletonUpdateSlider.value;
		Settings.fontsize = (int)FONTSIZE.value;
		Settings.Chams = ChamsToggle.isOn;
		Settings.drawaimpos = drawaimpostoggle.isOn;
		Settings.fullbright = fullbright.isOn;
		Settings.grenadeesp = grenadeesp.isOn;
		Settings.tripwire = DrawTripWires.isOn;
		SaveSettings();
	}

	public void UpdateItemESPSettingsUI()
	{
		if (drawLootItemsToggle != null)
		{
			drawLootItemsToggle.isOn = Settings.DrawLootItems;
		}
		if (drawLootItemsDistanceSlider != null)
		{
			drawLootItemsDistanceSlider.value = Settings.DrawLootItemsDistance;
		}
		if (drawlootitemsdistancelabel != null)
		{
			drawlootitemsdistancelabel.text = $"Item Distance : {(int)Settings.DrawLootItemsDistance} m";
		}
		if (superRareItemsToggle != null)
		{
			superRareItemsToggle.isOn = Settings.superrare;
		}
		if (kappaItemsToggle != null)
		{
			kappaItemsToggle.isOn = Settings.kappa;
		}
		if (questItemsToggle != null)
		{
			questItemsToggle.isOn = Settings.quest;
		}
		if (superrareTPToggle != null)
		{
			superrareTPToggle.isOn = Settings.superrareTP;
		}
		if (commonItemsToggle != null)
		{
			commonItemsToggle.isOn = Settings.common;
		}
		if (stimsItemsToggle != null)
		{
			stimsItemsToggle.isOn = Settings.stim;
		}
		if (KappaTPToggle != null)
		{
			KappaTPToggle.isOn = Settings.kappaTP;
		}
		if (QuestTPToggle != null)
		{
			QuestTPToggle.isOn = Settings.questTP;
		}
		if (SearchTPToggle != null)
		{
			SearchTPToggle.isOn = Settings.searchTP;
		}
		if (StimsTPToggle != null)
		{
			StimsTPToggle.isOn = Settings.StimTP;
		}
		if (commonItemsDistanceSlider != null)
		{
			commonItemsDistanceSlider.value = Settings.commonitemdistance;
		}
		if (commonItemsdistancelabel != null)
		{
			commonItemsdistancelabel.text = $"Common Item Distance : {(int)Settings.commonitemdistance} m";
		}
		if (drawLootableContainersToggle != null)
		{
			drawLootableContainersToggle.isOn = Settings.DrawLootableContainers;
		}
		if (drawLootableContainersDistanceSlider != null)
		{
			drawLootableContainersDistanceSlider.value = Settings.DrawLootableContainersDistance;
		}
		if (drawcontainerdistancelabel != null)
		{
			drawcontainerdistancelabel.text = $"Container Distance : {(int)Settings.DrawLootableContainersDistance} m";
		}
		if (bodyESPToggle != null)
		{
			bodyESPToggle.isOn = Settings.BodyESP;
		}
		if (playerInventoryESPToggle != null)
		{
			playerInventoryESPToggle.isOn = Settings.PlayerInventoryESP;
		}
		if (searchItemToggle != null)
		{
			searchItemToggle.isOn = Settings.searchItem;
		}
		if (teleportItemsToggle != null)
		{
			teleportItemsToggle.isOn = Settings.TeleportItems;
		}
		if (drawExfiltrationPointsToggle != null)
		{
			drawExfiltrationPointsToggle.isOn = Settings.DrawExfiltrationPoints;
		}
		if (ChamsToggle != null)
		{
			ChamsToggle.isOn = Settings.Chams;
		}
		if (DrawHideoutItems != null)
		{
			DrawHideoutItems.isOn = Settings.drawhideoutitems;
		}
		if (DrawWishlistItems != null)
		{
			DrawWishlistItems.isOn = Settings.drawwishlistitem;
		}
		if (ESPfiltervalue != null)
		{
			ESPfiltervalue.isOn = Settings.ESPFilterbyprice;
		}
		if (TPWishlistItems != null)
		{
			TPWishlistItems.isOn = Settings.TPwishlistitem;
		}
		if (TPHideoutItems != null)
		{
			TPHideoutItems.isOn = Settings.TPhideoutitem;
		}
		if (TPHVItems != null)
		{
			TPHVItems.isOn = Settings.TPHVitem;
		}
		if (DrawItemValue != null)
		{
			DrawItemValue.isOn = Settings.drawvalue;
		}
		if (ESPfiltervalueslider != null)
		{
			ESPfiltervalueslider.value = Settings.ESPPRICEfiltervalue;
		}
		if (ESPfiltervaluesliderlabel != null)
		{
			ESPfiltervaluesliderlabel.text = $"Minimum Item Value : {Settings.ESPPRICEfiltervalue / 1000}K";
		}
		if (ItemTPRadiusSlider != null)
		{
			ItemTPRadiusSlider.value = Settings.loottpradius;
		}
		if (ItemTPRadiusLabel != null)
		{
			ItemTPRadiusLabel.text = $"Teleport Radius : {(int)Settings.loottpradius} m";
		}
	}

	public void ApplyItemESPSettingsUI()
	{
		Settings.DrawLootItems = drawLootItemsToggle.isOn;
		Settings.DrawLootItemsDistance = drawLootItemsDistanceSlider.value;
		Settings.superrare = superRareItemsToggle.isOn;
		Settings.kappa = kappaItemsToggle.isOn;
		Settings.quest = questItemsToggle.isOn;
		Settings.common = commonItemsToggle.isOn;
		Settings.commonitemdistance = commonItemsDistanceSlider.value;
		Settings.DrawLootableContainers = drawLootableContainersToggle.isOn;
		Settings.DrawLootableContainersDistance = drawLootableContainersDistanceSlider.value;
		Settings.BodyESP = bodyESPToggle.isOn;
		Settings.PlayerInventoryESP = playerInventoryESPToggle.isOn;
		Settings.searchItem = searchItemToggle.isOn;
		Settings.TeleportItems = teleportItemsToggle.isOn;
		Settings.DrawExfiltrationPoints = drawExfiltrationPointsToggle.isOn;
		Settings.superrareTP = superrareTPToggle.isOn;
		Settings.StimTP = StimsTPToggle.isOn;
		Settings.kappaTP = KappaTPToggle.isOn;
		Settings.searchTP = SearchTPToggle.isOn;
		Settings.questTP = QuestTPToggle.isOn;
		Settings.stim = stimsItemsToggle.isOn;
		Settings.TPHVitem = TPHVItems.isOn;
		Settings.TPhideoutitem = TPHideoutItems.isOn;
		Settings.TPwishlistitem = TPWishlistItems.isOn;
		Settings.drawhideoutitems = DrawHideoutItems.isOn;
		Settings.drawwishlistitem = DrawWishlistItems.isOn;
		Settings.ESPFilterbyprice = ESPfiltervalue.isOn;
		Settings.drawvalue = DrawItemValue.isOn;
		Settings.ESPPRICEfiltervalue = (int)ESPfiltervalueslider.value;
		Settings.loottpradius = ItemTPRadiusSlider.value;
		SaveSettings();
	}

	public void UpdateMiscOptionsSettingsUI()
	{
		if (flyhackToggle != null)
		{
			flyhackToggle.isOn = Settings.Flyhack;
		}
		if (speedhackToggle != null)
		{
			speedhackToggle.isOn = Settings.Speedhack;
		}
		if (speedSlider != null)
		{
			speedSlider.value = Settings.Speed;
		}
		if (maincamfovchanger != null)
		{
			maincamfovchanger.isOn = Settings.changemaincamfov;
		}
		if (maincamfov != null)
		{
			maincamfov.value = Settings.maincamfov;
		}
		if (xpslider != null)
		{
			xpslider.value = Settings.expamount;
		}
		if (xpsliderlabel != null)
		{
			xpsliderlabel.text = $"XP {(int)Settings.expamount}";
		}
		if (infStaminaToggle != null)
		{
			infStaminaToggle.isOn = Settings.Infstamina;
		}
		if (instaHealToggle != null)
		{
			instaHealToggle.isOn = Settings.Instaheal;
		}
		if (thermalVisionToggle != null)
		{
			thermalVisionToggle.isOn = Settings.Thermal;
		}
		if (godmodeToggle != null)
		{
			godmodeToggle.isOn = Settings.Godmode;
		}
		if (instaSearchToggle != null)
		{
			instaSearchToggle.isOn = Settings.InstaSearch;
		}
		if (noVisorToggle != null)
		{
			noVisorToggle.isOn = Settings.NoVisor;
		}
		if (flaresToggle != null)
		{
			flaresToggle.isOn = Settings.flares;
		}
		if (noJamToggle != null)
		{
			noJamToggle.isOn = Settings.nojam;
		}
		if (fireRateToggle != null)
		{
			fireRateToggle.isOn = Settings.firerate;
		}
		if (showitemspawnmenu != null)
		{
			showitemspawnmenu.isOn = Settings.Itemspawnmenu;
		}
		if (weaponchams != null)
		{
			weaponchams.isOn = Settings.weaponchams;
		}
		if (alwayssurvived != null)
		{
			alwayssurvived.isOn = Settings.alwayssurvived;
		}
		if (tppmc != null)
		{
			tppmc.isOn = Settings.tppmc;
		}
		if (tpboss != null)
		{
			tpboss.isOn = Settings.tpboss;
		}
		if (sicc != null)
		{
			sicc.isOn = Settings.sicc;
		}
		if (thicc != null)
		{
			thicc.isOn = Settings.thicc;
		}
		if (ammobox != null)
		{
			ammobox.isOn = Settings.ammobox;
		}
		if (bypassrestrictions != null)
		{
			bypassrestrictions.isOn = Settings.removefilters;
		}
		if (fillraidbp != null)
		{
			fillraidbp.isOn = Settings.fillraidbp;
		}
		if (autofillslots != null)
		{
			autofillslots.isOn = Settings.fillslots;
		}
		if (farreachtoggle != null)
		{
			farreachtoggle.isOn = Settings.farreach;
		}
		if (invisibletoggle != null)
		{
			invisibletoggle.isOn = Settings.invisible;
		}
		if (QuestESP != null)
		{
			QuestESP.isOn = Settings.QuestESP;
		}
		if (QuestDescription != null)
		{
			QuestDescription.isOn = Settings.DrawDescription;
		}
		if (SimplifiedStrings != null)
		{
			SimplifiedStrings.isOn = Settings.DrawSimpleStrings;
		}
		if (DrawOutline != null)
		{
			DrawOutline.isOn = Settings.DrawOutline;
		}
		if (Artillery != null)
		{
			Artillery.isOn = Settings.artillery;
		}
		if (DrawWatermark != null)
		{
			DrawWatermark.isOn = Settings.drawwatermark;
		}
		if (DurabilityExploit != null)
		{
			DurabilityExploit.isOn = Settings.componentexploit;
		}
		if (filtersuperrare != null)
		{
			filtersuperrare.isOn = Settings.filtersuperrare;
		}
		if (filterkappa != null)
		{
			filterkappa.isOn = Settings.filterkappa;
		}
		if (filterquest != null)
		{
			filterquest.isOn = Settings.filterquest;
		}
		if (filterwishlist != null)
		{
			filterwishlist.isOn = Settings.filterwishlist;
		}
		if (filterstim != null)
		{
			filterstim.isOn = Settings.filterstim;
		}
		if (ShowColorMenu != null)
		{
			ShowColorMenu.isOn = Settings.ShowColorSettingsMenu;
		}
		if (disableallinputs != null)
		{
			disableallinputs.isOn = Settings.allinputdisabled;
		}
		if (filterhideout != null)
		{
			filterhideout.isOn = Settings.filterhideout;
		}
		if (filtervalue != null)
		{
			filtervalue.isOn = Settings.filtervalue;
		}
		if (filtervalueslider != null)
		{
			filtervalueslider.value = Settings.moneyfiltervalue;
		}
		if (filtervalueslidertext != null)
		{
			filtervalueslidertext.text = $"Minimum Value : {Settings.moneyfiltervalue / 1000}K ";
		}
		if (SpoofNicknameToggle != null)
		{
			SpoofNicknameToggle.isOn = Settings.hidenick;
		}
		if (bigheadstoggle != null)
		{
			bigheadstoggle.isOn = Settings.BigHeads;
		}
		if (showraidsettingsmenu != null)
		{
			showraidsettingsmenu.isOn = Settings.showraidsettingsmenu;
		}
		if (modifyraidsettingstoggle != null)
		{
			modifyraidsettingstoggle.isOn = Settings.modifyraidsettings;
		}
		if (makeallbotsfriendlytoggle != null)
		{
			makeallbotsfriendlytoggle.isOn = Settings.makeallbotsfriendly;
		}
	}

	public void ApplyMiscOptionsSettingsUI()
	{
		Settings.Flyhack = flyhackToggle.isOn;
		Settings.Speedhack = speedhackToggle.isOn;
		Settings.Speed = speedSlider.value;
		Settings.changemaincamfov = maincamfovchanger.isOn;
		Settings.maincamfov = maincamfov.value;
		Settings.expamount = xpslider.value;
		Settings.Infstamina = infStaminaToggle.isOn;
		Settings.Instaheal = instaHealToggle.isOn;
		Settings.Thermal = thermalVisionToggle.isOn;
		Settings.Godmode = godmodeToggle.isOn;
		Settings.InstaSearch = instaSearchToggle.isOn;
		Settings.NoVisor = noVisorToggle.isOn;
		Settings.flares = flaresToggle.isOn;
		Settings.nojam = noJamToggle.isOn;
		Settings.firerate = fireRateToggle.isOn;
		Settings.Itemspawnmenu = showitemspawnmenu.isOn;
		Settings.weaponchams = weaponchams.isOn;
		Settings.alwayssurvived = alwayssurvived.isOn;
		Settings.tppmc = tppmc.isOn;
		Settings.tpboss = tpboss.isOn;
		Settings.QuestESP = QuestESP.isOn;
		Settings.DrawDescription = QuestDescription.isOn;
		Settings.DrawSimpleStrings = SimplifiedStrings.isOn;
		Settings.DrawOutline = DrawOutline.isOn;
		Settings.artillery = Artillery.isOn;
		Settings.drawwatermark = DrawWatermark.isOn;
		Settings.componentexploit = DurabilityExploit.isOn;
		Settings.thicc = thicc.isOn;
		Settings.sicc = sicc.isOn;
		Settings.ammobox = ammobox.isOn;
		Settings.removefilters = bypassrestrictions.isOn;
		Settings.fillraidbp = fillraidbp.isOn;
		Settings.fillslots = autofillslots.isOn;
		Settings.farreach = farreachtoggle.isOn;
		Settings.invisible = invisibletoggle.isOn;
		Settings.filtersuperrare = filtersuperrare.isOn;
		Settings.filterkappa = filterkappa.isOn;
		Settings.filterquest = filterquest.isOn;
		Settings.filterwishlist = filterwishlist.isOn;
		Settings.filterstim = filterstim.isOn;
		Settings.ShowColorSettingsMenu = ShowColorMenu.isOn;
		Settings.allinputdisabled = disableallinputs.isOn;
		Settings.filterhideout = filterhideout.isOn;
		Settings.filtervalue = filtervalue.isOn;
		Settings.moneyfiltervalue = (int)filtervalueslider.value;
		Settings.hidenick = SpoofNicknameToggle.isOn;
		Settings.BigHeads = bigheadstoggle.isOn;
		Settings.showraidsettingsmenu = showraidsettingsmenu.isOn;
		Settings.modifyraidsettings = modifyraidsettingstoggle.isOn;
		Settings.makeallbotsfriendly = makeallbotsfriendlytoggle.isOn;
		SaveSettings();
	}

	private void OnSearchItemValueChanged(string input)
	{
		if (!string.IsNullOrWhiteSpace(input))
		{
			publicSearchString = input;
		}
	}

	private void OnSearchItemInputEndEdit(string input)
	{
		if (!string.IsNullOrWhiteSpace(input))
		{
			publicSearchString = input;
		}
	}

	private void SpawnItemValueChanged(string input)
	{
		if (!string.IsNullOrWhiteSpace(input))
		{
			itemidstring = input;
		}
	}

	private void SpawnItemInputEndEdit(string input)
	{
		if (!string.IsNullOrWhiteSpace(input))
		{
			itemidstring = input;
		}
	}

	private void SpawnAIValueChanged(string input)
	{
		if (!string.IsNullOrWhiteSpace(input))
		{
			spawnid = input;
		}
	}

	private void SpawnAIInputEndEdit(string input)
	{
		if (!string.IsNullOrWhiteSpace(input))
		{
			spawnid = input;
		}
	}

	public void AddToggleListeners()
	{
		if (aimbotToggle != null)
		{
			aimbotToggle.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (noRecoilToggle != null)
		{
			noRecoilToggle.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (crosshairToggle != null)
		{
			crosshairToggle.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (silentAimToggle != null)
		{
			silentAimToggle.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (silentTargetLinesToggle != null)
		{
			silentTargetLinesToggle.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (instahitToggle != null)
		{
			instahitToggle.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (ammodrawToggle != null)
		{
			ammodrawToggle.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (CheckVisibletoggle != null)
		{
			CheckVisibletoggle.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (MagicBulletToggle != null)
		{
			MagicBulletToggle.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (infiniteammo != null)
		{
			infiniteammo.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (aimbotDrawFOVToggle != null)
		{
			aimbotDrawFOVToggle.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (tracers != null)
		{
			tracers.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (hitmarkers != null)
		{
			hitmarkers.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (drawPlayersToggle != null)
		{
			drawPlayersToggle.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (drawPlayerBoxToggle != null)
		{
			drawPlayerBoxToggle.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (drawPlayerNameToggle != null)
		{
			drawPlayerNameToggle.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (drawPlayerLineToggle != null)
		{
			drawPlayerLineToggle.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (drawPlayerHealthToggle != null)
		{
			drawPlayerHealthToggle.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (drawWeaponToggle != null)
		{
			drawWeaponToggle.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (enableSkeletonToggle != null)
		{
			enableSkeletonToggle.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (drawRadarToggle != null)
		{
			drawRadarToggle.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (ChamsToggle != null)
		{
			ChamsToggle.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (drawaimpostoggle != null)
		{
			drawaimpostoggle.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (fullbright != null)
		{
			fullbright.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (grenadeesp != null)
		{
			grenadeesp.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (DrawTripWires != null)
		{
			DrawTripWires.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (drawLootItemsToggle != null)
		{
			drawLootItemsToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (superRareItemsToggle != null)
		{
			superRareItemsToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (kappaItemsToggle != null)
		{
			kappaItemsToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (questItemsToggle != null)
		{
			questItemsToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (commonItemsToggle != null)
		{
			commonItemsToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (drawLootableContainersToggle != null)
		{
			drawLootableContainersToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (bodyESPToggle != null)
		{
			bodyESPToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (playerInventoryESPToggle != null)
		{
			playerInventoryESPToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (searchItemToggle != null)
		{
			searchItemToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (teleportItemsToggle != null)
		{
			teleportItemsToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (drawExfiltrationPointsToggle != null)
		{
			drawExfiltrationPointsToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (stimsItemsToggle != null)
		{
			stimsItemsToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (superrareTPToggle != null)
		{
			superrareTPToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (KappaTPToggle != null)
		{
			KappaTPToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (QuestTPToggle != null)
		{
			QuestTPToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (StimsTPToggle != null)
		{
			StimsTPToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (SearchTPToggle != null)
		{
			SearchTPToggle.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (flyhackToggle != null)
		{
			flyhackToggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (speedhackToggle != null)
		{
			speedhackToggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (maincamfovchanger != null)
		{
			maincamfovchanger.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (infStaminaToggle != null)
		{
			infStaminaToggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (instaHealToggle != null)
		{
			instaHealToggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (thermalVisionToggle != null)
		{
			thermalVisionToggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (godmodeToggle != null)
		{
			godmodeToggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (instaSearchToggle != null)
		{
			instaSearchToggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (noVisorToggle != null)
		{
			noVisorToggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (flaresToggle != null)
		{
			flaresToggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (noJamToggle != null)
		{
			noJamToggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (fireRateToggle != null)
		{
			fireRateToggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (farreachtoggle != null)
		{
			farreachtoggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (invisibletoggle != null)
		{
			invisibletoggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (showitemspawnmenu != null)
		{
			showitemspawnmenu.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (thicc != null)
		{
			thicc.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (sicc != null)
		{
			sicc.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (autofillslots != null)
		{
			autofillslots.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (ammobox != null)
		{
			ammobox.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (bypassrestrictions != null)
		{
			bypassrestrictions.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (fillraidbp != null)
		{
			fillraidbp.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (weaponchams != null)
		{
			weaponchams.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (alwayssurvived != null)
		{
			alwayssurvived.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (tppmc != null)
		{
			tppmc.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (tpboss != null)
		{
			tpboss.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (QuestESP != null)
		{
			QuestESP.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (QuestDescription != null)
		{
			QuestDescription.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (SimplifiedStrings != null)
		{
			SimplifiedStrings.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (DrawOutline != null)
		{
			DrawOutline.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (Artillery != null)
		{
			Artillery.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (DrawWatermark != null)
		{
			DrawWatermark.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (DurabilityExploit != null)
		{
			DurabilityExploit.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (DrawHideoutItems != null)
		{
			DrawHideoutItems.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (DrawWishlistItems != null)
		{
			DrawWishlistItems.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (ESPfiltervalue != null)
		{
			ESPfiltervalue.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (DrawItemValue != null)
		{
			DrawItemValue.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (filtersuperrare != null)
		{
			filtersuperrare.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (filterkappa != null)
		{
			filterkappa.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (filterquest != null)
		{
			filterquest.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (filterwishlist != null)
		{
			filterwishlist.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (filterstim != null)
		{
			filterstim.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (TPWishlistItems != null)
		{
			TPWishlistItems.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (TPHideoutItems != null)
		{
			TPHideoutItems.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (TPHVItems != null)
		{
			TPHVItems.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (ShowColorMenu != null)
		{
			ShowColorMenu.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (disableallinputs != null)
		{
			disableallinputs.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (filterhideout != null)
		{
			filterhideout.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (filtervalue != null)
		{
			filtervalue.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (SpoofNicknameToggle != null)
		{
			SpoofNicknameToggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (bulletspershottoggle != null)
		{
			bulletspershottoggle.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (bigheadstoggle != null)
		{
			bigheadstoggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (showraidsettingsmenu != null)
		{
			showraidsettingsmenu.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (makeallbotsfriendlytoggle != null)
		{
			makeallbotsfriendlytoggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (modifyraidsettingstoggle != null)
		{
			modifyraidsettingstoggle.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		SaveSettings();
	}

	private void AddSliderListeners()
	{
		if (aimbotSmoothSlider != null)
		{
			aimbotSmoothSlider.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (aimbotFOVSlider != null)
		{
			aimbotFOVSlider.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (radardistanceslider != null)
		{
			radardistanceslider.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (SkeletonUpdateSlider != null)
		{
			SkeletonUpdateSlider.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (FONTSIZE != null)
		{
			FONTSIZE.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (drawPlayersDistanceSlider != null)
		{
			drawPlayersDistanceSlider.onValueChanged.AddListener(delegate
			{
				ApplyPlayerESPSettingsUI();
			});
		}
		if (drawLootItemsDistanceSlider != null)
		{
			drawLootItemsDistanceSlider.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (commonItemsDistanceSlider != null)
		{
			commonItemsDistanceSlider.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (drawLootableContainersDistanceSlider != null)
		{
			drawLootableContainersDistanceSlider.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (speedSlider != null)
		{
			speedSlider.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (maincamfov != null)
		{
			maincamfov.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (xpslider != null)
		{
			xpslider.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (filtervalueslider != null)
		{
			filtervalueslider.onValueChanged.AddListener(delegate
			{
				ApplyMiscOptionsSettingsUI();
			});
		}
		if (ESPfiltervalueslider != null)
		{
			ESPfiltervalueslider.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
		if (bulletspershot != null)
		{
			bulletspershot.onValueChanged.AddListener(delegate
			{
				ApplyAimbotSettingsUI();
			});
		}
		if (ItemTPRadiusSlider != null)
		{
			ItemTPRadiusSlider.onValueChanged.AddListener(delegate
			{
				ApplyItemESPSettingsUI();
			});
		}
	}

	public void MaxWeaponskill()
	{
		Player localPlayer = Main.LocalPlayer;
		if (!(localPlayer != null))
		{
			return;
		}
		foreach (_E9D4 value in localPlayer.Skills.Mastering.Values)
		{
			value.Current = value.MasteringGroup.Level2 + value.MasteringGroup.Level3;
		}
	}

	private void PopulateRaidSettingsDropdowns()
	{
		PopulateRaidDropdown(botAmountDropdown, typeof(EBotAmount));
		PopulateRaidDropdown(botDifficultyDropdown, typeof(EBotDifficulty));
		PopulateRaidDropdown(windTypeDropdown, typeof(EWindSpeed));
		PopulateRaidDropdown(timeFlowTypeDropdown, typeof(ETimeFlowType));
		PopulateRaidDropdown(cloudinessTypeDropdown, typeof(ECloudinessType));
		PopulateRaidDropdown(rainTypeDropdown, typeof(ERainType));
		botAmountDropdown.value = 0;
		botDifficultyDropdown.value = 0;
		windTypeDropdown.value = 0;
		timeFlowTypeDropdown.value = 0;
		cloudinessTypeDropdown.value = 0;
		rainTypeDropdown.value = 0;
	}

	private void PopulateRaidDropdown(TMP_Dropdown dropdown, Type enumType)
	{
		dropdown.ClearOptions();
		List<string> list = new List<string> { "Default" };
		list.AddRange(Enum.GetNames(enumType));
		dropdown.AddOptions(list);
	}

	private void ApplyRaidSettings()
	{
		if (Settings.modifyraidsettings && !(LocationsFixerV2._tarkovApplication == null) && !(Main.GameWorld != null))
		{
			RaidSettings currentRaidSettings = LocationsFixerV2._tarkovApplication.CurrentRaidSettings;
			if (botAmountDropdown.value != 0)
			{
				currentRaidSettings.BotSettings.BotAmount = (EBotAmount)(botAmountDropdown.value - 1);
			}
			if (botDifficultyDropdown.value != 0)
			{
				currentRaidSettings.WavesSettings.BotDifficulty = (EBotDifficulty)(botDifficultyDropdown.value - 1);
			}
			currentRaidSettings.WavesSettings.IsTaggedAndCursed = taggedAndCursedToggle.isOn;
			currentRaidSettings.MetabolismDisabled = metabolismDisabledToggle.isOn;
			currentRaidSettings.BotSettings.IsScavWars = scavwartoggle.isOn;
			if (windTypeDropdown.value != 0)
			{
				currentRaidSettings.TimeAndWeatherSettings.WindType = (EWindSpeed)(windTypeDropdown.value - 1);
			}
			if (timeFlowTypeDropdown.value != 0)
			{
				currentRaidSettings.TimeAndWeatherSettings.TimeFlowType = (ETimeFlowType)(timeFlowTypeDropdown.value - 1);
			}
			if (cloudinessTypeDropdown.value != 0)
			{
				currentRaidSettings.TimeAndWeatherSettings.CloudinessType = (ECloudinessType)(cloudinessTypeDropdown.value - 1);
			}
			if (rainTypeDropdown.value != 0)
			{
				currentRaidSettings.TimeAndWeatherSettings.RainType = (ERainType)(rainTypeDropdown.value - 1);
			}
		}
	}

	public void UpdateEntityList()
	{
		if (entityButtonTemplate == null)
		{
			return;
		}
		if (Main.GameWorld == null || Main.GamePlayers.Count < 1)
		{
			ClearAllEntitiesFromList();
			return;
		}
		HashSet<string> currentEntityIds = new HashSet<string>();
		foreach (GamePlayer gamePlayer in Main.GamePlayers)
		{
			if (gamePlayer != null && !(gamePlayer.Player == null) && !gamePlayer.Player.IsYourPlayer && gamePlayer.Player.Profile?.Info?.Settings != null)
			{
				string text = gamePlayer.Player.GetInstanceID().ToString();
				currentEntityIds.Add(text);
				if (!activeEntityButtons.ContainsKey(text))
				{
					AddEntityToList(gamePlayer, text);
				}
			}
		}
		foreach (string item in activeEntityButtons.Keys.Where((string id) => !currentEntityIds.Contains(id)).ToList())
		{
			UnityEngine.Object.Destroy(activeEntityButtons[item]);
			activeEntityButtons.Remove(item);
		}
		if (activeEntityButtons.Count == 0)
		{
			noentitiestexttmp.text = "No Entities to List";
		}
		else
		{
			noentitiestexttmp.text = " ";
		}
		if (selectedEntity != null && !selectedEntity.HealthController.IsAlive)
		{
			selectedEntity = null;
			entityInfoText.text = " Please Select an Entity\n From The List !";
		}
		else if (selectedEntity == null && entityInfoText.text != null)
		{
			entityInfoText.text = " Please Select an Entity\n From The List !";
		}
		LayoutRebuilder.ForceRebuildLayoutImmediate(entityButtonContainer.GetComponent<RectTransform>());
		Canvas.ForceUpdateCanvases();
	}

	private void AddEntityToList(GamePlayer player, string id)
	{
		if (entityButtonTemplate == null)
		{
			return;
		}
		GameObject gameObject = UnityEngine.Object.Instantiate(entityButtonTemplate, entityButtonContainer);
		if (gameObject == null)
		{
			return;
		}
		TMP_Text componentInChildren = gameObject.GetComponentInChildren<TMP_Text>();
		var (nickname, color) = EntityManager.GetEntityDisplayInfo(player);
		if (componentInChildren != null)
		{
			componentInChildren.text = nickname;
			componentInChildren.color = color;
		}
		Button component = gameObject.GetComponent<Button>();
		if (component != null)
		{
			GamePlayer capturedPlayer = player;
			component.onClick.AddListener(delegate
			{
				OnEntityButtonClick(capturedPlayer, nickname);
			});
		}
		gameObject.SetActive(value: true);
		activeEntityButtons[id] = gameObject;
	}

	private void ClearAllEntitiesFromList()
	{
		foreach (Transform item in entityButtonContainer)
		{
			UnityEngine.Object.Destroy(item.gameObject);
		}
		activeEntityButtons.Clear();
		noentitiestexttmp.text = "No Entities to List";
		if (selectedEntity != null)
		{
			selectedEntity = null;
			entityInfoText.text = " Please Select an Entity\n From The List !";
		}
	}

	private void OnEntityButtonClick(GamePlayer entity, string name)
	{
		if (entity == null)
		{
			return;
		}
		foreach (GamePlayer gamePlayer in Main.GamePlayers)
		{
			if (gamePlayer == entity)
			{
				gamePlayer.isselected = true;
			}
			else
			{
				gamePlayer.isselected = false;
			}
		}
		selectedEntity = entity.Player;
		UpdateEntityInfoText(name);
	}

	public void UpdateEntityInfoText(string name = "", bool disregardstring = false)
	{
		_E9AD info = selectedEntity.Profile.Info;
		string text = "";
		if (disregardstring)
		{
			foreach (GamePlayer gamePlayer in Main.GamePlayers)
			{
				if (gamePlayer.Player == selectedEntity)
				{
					string item = EntityManager.GetEntityDisplayInfo(gamePlayer).displayName;
					text = item;
				}
			}
		}
		else
		{
			text = name;
		}
		entityInfoText.text = "Selected Entity:\nESP Name: " + text + "\n" + $"Role: {info.Settings.Role}\n" + $"Side: {info.Side}\n" + $"Is Ally ? : {selectedEntity.AIData.BotOwner.BotsGroup.IsAlly(Main.LocalPlayer)}\n" + $"Health: [{selectedEntity.ActiveHealthController.GetBodyPartHealth(EBodyPart.Common).Current:F0}/{selectedEntity.ActiveHealthController.GetBodyPartHealth(EBodyPart.Common).Maximum:F0}]";
	}

	public void OnKillEntityClick()
	{
		EntityManager.KillEntity(selectedEntity);
		if (!selectedEntity.HealthController.IsAlive)
		{
			entityInfoText.text = " Please Select an Entity\n From The List !";
		}
		else
		{
			UpdateEntityInfoText(string.Empty, disregardstring: true);
		}
	}

	public void OnHealEntityClick()
	{
		EntityManager.HealEntity(selectedEntity);
		UpdateEntityInfoText(string.Empty, disregardstring: true);
	}

	public void OnTeleportEntityClick()
	{
		EntityManager.TeleportEntityToCrosshair(selectedEntity);
		UpdateEntityInfoText(string.Empty, disregardstring: true);
	}

	public void onmakebraindeadclick()
	{
		EntityManager.ToggleOffEntityObject(selectedEntity);
		UpdateEntityInfoText(string.Empty, disregardstring: true);
	}

	public void ongivebotblickykitclick()
	{
		EntityManager.GiveBotsBlickyKit(selectedEntity);
		UpdateEntityInfoText(string.Empty, disregardstring: true);
	}

	public void ongiveallbotsblickykitclick()
	{
		foreach (GamePlayer gamePlayer in Main.GamePlayers)
		{
			EntityManager.GiveBotsBlickyKit(gamePlayer.Player);
		}
	}
}
