using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using Fusion;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Reflection;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("AskaAdminMenu")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AskaAdminMenu")]
[assembly: AssemblyTitle("AskaAdminMenu")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AskaAdminMenu;
[BepInPlugin("com.aska.adminmenu", "ASKA Admin Menu", "3.7.0")]
public class Plugin : BasePlugin
{
private bool showMenu = false;
private Rect windowRect = new Rect(20f, 20f, 800f, 500f);
private int currentTab = 0;
private string searchQuery = "";
private Vector2 scrollPosition;
private Vector2 playersScrollPosition;
private Dictionary<string, List<string>> categorizedItems = new Dictionary<string, List<string>>();
private Dictionary<string, bool> categoryFolds = new Dictionary<string, bool>();
private List<string> banList = new List<string>();
public override void Load()
{
((BasePlugin)this).Log.LogInfo((object)"ASKA Admin Menu 3.7.0 Loaded!");
((BasePlugin)this).AddComponent<AdminMenuUI>();
}
}
public class AdminMenuUI : MonoBehaviour
{
private bool showMenu = false;
private Rect windowRect = new Rect(20f, 20f, 800f, 500f);
private int currentTab = 0;
private string searchQuery = "";
private string activeSearchQuery = "";
private Vector2 scrollPosition;
private Vector2 playersScrollPosition;
private Dictionary<string, List<string>> categorizedItems = new Dictionary<string, List<string>>();
private Dictionary<string, bool> categoryFolds = new Dictionary<string, bool>();
private List<string> banList = new List<string>();
private void Start()
{
LoadItems();
LoadBanList();
}
private void LoadBanList()
{
try
{
string path = Path.Combine(Paths.ConfigPath, "AskaBannedPlayers.txt");
if (File.Exists(path))
{
banList = new List<string>(File.ReadAllLines(path));
}
}
catch
{
}
}
private void SaveBanList()
{
try
{
File.WriteAllLines(Path.Combine(Paths.ConfigPath, "AskaBannedPlayers.txt"), banList.ToArray());
}
catch
{
}
}
private void LoadItems()
{
string[] array = new string[5] { "Food", "Weapons", "Tools", "Armor", "Fishing" };
string[] array2 = array;
foreach (string key in array2)
{
categorizedItems[key] = new List<string>();
categoryFolds[key] = false;
}
try
{
string path = Path.Combine(Paths.ConfigPath, "FullItemList.txt");
string[] array3 = (File.Exists(path) ? File.ReadAllLines(path) : new string[0]);
string[] array4 = array3;
foreach (string text in array4)
{
string text2 = text.Trim();
if (string.IsNullOrEmpty(text2) || text2.Contains("(Clone)"))
{
continue;
}
string text3 = text2.ToLower();
if (!text3.EndsWith("bp") && !text3.EndsWith("ref") && !text3.Contains("icon") && !text3.EndsWith("nogeo") && !text3.Contains("template") && !text3.Contains("recipe") && !text3.Contains("dev") && !text3.Contains("test") && !text3.Contains("fx") && !text3.Contains("marker") && !text3.Contains("preview") && !text3.Contains("spawner") && !text3.Contains("logic") && !text3.Contains("trigger") && !text3.Contains("camera") && !text3.Contains("audio") && !text3.Contains("system") && !text3.Contains("collider"))
{
if (text2.StartsWith("Item_Food_") || text2.StartsWith("Item_Cooking_"))
{
categorizedItems["Food"].Add(text2);
}
else if (text2.StartsWith("Item_OneHanded_") || text2.StartsWith("Item_TwoHanded_") || text2.StartsWith("Item_Bows_") || text2.StartsWith("Item_Arrows_") || text2.StartsWith("Item_Shields_") || text2.StartsWith("Item_Weaponry_"))
{
categorizedItems["Weapons"].Add(text2);
}
else if (text2.StartsWith("Item_Helmets_") || text2.StartsWith("Item_Armor_") || text2.StartsWith("Item_Pants_") || text2.StartsWith("Item_Cape_") || text2.StartsWith("Item_Boots_") || text2.StartsWith("Item_Shoulders_") || text2.StartsWith("Item_Gloves_"))
{
categorizedItems["Armor"].Add(text2);
}
else if (text2.StartsWith("Item_Bait_") || text3.Contains("fishingrod"))
{
categorizedItems["Fishing"].Add(text2);
}
else if (text2.StartsWith("Item_Axes_") || text2.StartsWith("Item_Pickaxes_") || text2.StartsWith("Item_Hammers_") || text2.StartsWith("Item_Hoes_") || text2.StartsWith("Item_Knives_") || text2.StartsWith("Item_SpecialTools_") || text2.StartsWith("Item_Tools_") || text2.StartsWith("Item_Bushcraft_"))
{
categorizedItems["Tools"].Add(text2);
}
}
}
string[] array5 = array;
foreach (string key2 in array5)
{
categorizedItems[key2] = (from x in categorizedItems[key2].Distinct()
orderby x
select x).ToList();
}
}
catch (Exception ex)
{
LogDebug("Error loading items: " + ex.Message);
}
}
private void LogDebug(string msg)
{
Debug.Log(Object.op_Implicit("[ASKA ADMIN] " + msg));
}
private void SetPlayerInput(bool active)
{
try
{
Il2CppArrayBase<MonoBehaviour> val = Object.FindObjectsOfType<MonoBehaviour>();
foreach (MonoBehaviour item in val)
{
string name = ((MemberInfo)((Object)item).GetIl2CppType()).Name;
if (name == "PlayerInput" || name == "vMeleeCombatInput" || name == "vThirdPersonInput")
{
try
{
if (active)
{
((Component)item).SendMessage("ActivateInput", (SendMessageOptions)1);
}
else
{
((Component)item).SendMessage("DeactivateInput", (SendMessageOptions)1);
}
}
catch
{
}
}
if (name.Contains("Input") || name.Contains("CameraController") || name.Contains("CinemachineBrain") || name.Contains("CameraManager") || name.Contains("PlayerHUDMenu"))
{
try
{
((Behaviour)item).enabled = active;
}
catch
{
}
}
}
}
catch
{
}
}
private void Update()
{
if (Time.frameCount % 120 == 0)
{
EnforceBanList();
}
if (Input.GetKeyDown((KeyCode)289))
{
showMenu = !showMenu;
SetPlayerInput(!showMenu);
if (showMenu)
{
Cursor.visible = true;
Cursor.lockState = (CursorLockMode)0;
}
else
{
Cursor.visible = false;
Cursor.lockState = (CursorLockMode)1;
}
}
if (showMenu)
{
Cursor.visible = true;
Cursor.lockState = (CursorLockMode)0;
}
}
private void EnforceBanList()
{
Il2CppArrayBase<MonoBehaviour> val = Object.FindObjectsOfType<MonoBehaviour>();
foreach (MonoBehaviour item in val)
{
if (!(((MemberInfo)((Object)item).GetIl2CppType()).Name == "PlayerCharacter"))
{
continue;
}
GameObject gameObject = ((Component)item).gameObject;
NetworkObject component = gameObject.GetComponent<NetworkObject>();
if (!((Object)(object)component == (Object)null) && !component.HasStateAuthority)
{
string playerName = GetPlayerName(gameObject, component);
if (banList.Contains(playerName))
{
KickPlayer(component);
}
}
}
}
private void OnGUI()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Invalid comparison between Unknown and I4
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Invalid comparison between Unknown and I4
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Invalid comparison between Unknown and I4
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Invalid comparison between Unknown and I4
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Expected O, but got Unknown
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
//IL_0303: Unknown result type (might be due to invalid IL or missing references)
if (Event.current != null && (int)Event.current.type == 8)
{
activeSearchQuery = searchQuery;
}
if (showMenu && Event.current != null && (int)Event.current.type == 4 && (int)Event.current.keyCode == 27)
{
showMenu = false;
SetPlayerInput(active: true);
Event.current.Use();
}
else if (showMenu)
{
if (((Rect)(ref windowRect)).Contains(Event.current.mousePosition) && (int)Event.current.type == 6)
{
Event.current.Use();
}
if (((int)Event.current.type == 0 || (int)Event.current.type == 1) && !((Rect)(ref windowRect)).Contains(Event.current.mousePosition))
{
Event.current.Use();
}
GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 1f);
GUI.Box(windowRect, GUIContent.none);
GUI.Box(windowRect, GUIContent.none);
GUILayout.BeginArea(new Rect(((Rect)(ref windowRect)).x + 15f, ((Rect)(ref windowRect)).y + 15f, ((Rect)(ref windowRect)).width - 30f, ((Rect)(ref windowRect)).height - 30f));
GUIStyle val = new GUIStyle(GUI.skin.label)
{
fontSize = 22,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)4
};
val.normal.textColor = Color.white;
GUILayout.Label("ASKA SERVER ADMIN", val, (Il2CppReferenceArray<GUILayoutOption>)null);
GUILayout.Space(15f);
GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
GUI.backgroundColor = (Color)((currentTab == 0) ? new Color(0.2f, 0.8f, 0.2f) : Color.gray);
if (GUILayout.Button("Items", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(35f) }))
{
currentTab = 0;
}
GUI.backgroundColor = (Color)((currentTab == 1) ? new Color(0.2f, 0.8f, 0.2f) : Color.gray);
if (GUILayout.Button("Players", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(35f) }))
{
currentTab = 1;
}
GUI.backgroundColor = new Color(0.8f, 0.2f, 0.2f);
if (GUILayout.Button("Close", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(35f) }))
{
showMenu = false;
SetPlayerInput(active: true);
Cursor.visible = false;
Cursor.lockState = (CursorLockMode)1;
}
GUI.backgroundColor = Color.white;
GUILayout.EndHorizontal();
GUILayout.Space(15f);
if (currentTab == 0)
{
DrawItemsTab();
}
else if (currentTab == 1)
{
DrawPlayersTab();
}
GUILayout.EndArea();
}
}
private void DeleteAimedItem()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (!((Object)(object)Camera.main != (Object)null) || !Physics.Raycast(Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)), ref val, 100f))
{
return;
}
GameObject gameObject = ((Component)((RaycastHit)(ref val)).collider).gameObject;
NetworkObject componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<NetworkObject>();
try
{
NetworkRunner val2 = Object.FindObjectOfType<NetworkRunner>();
if ((Object)(object)val2 != (Object)null && (Object)(object)componentInParent != (Object)null)
{
val2.Despawn(componentInParent, false);
return;
}
}
catch
{
}
if ((Object)(object)componentInParent != (Object)null)
{
Object.Destroy((Object)(object)((Component)componentInParent).gameObject);
}
else
{
Object.Destroy((Object)(object)gameObject);
}
}
private void DrawItemsTab()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: Unknown result type (might be due to invalid IL or missing references)
GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
GUILayout.Label("Search:", new GUIStyle(GUI.skin.label)
{
fontStyle = (FontStyle)1
}, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
searchQuery = GUILayout.TextField(searchQuery, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) });
GUI.backgroundColor = new Color(0.9f, 0.2f, 0.2f);
if (GUILayout.Button("Delete Aimed Item", (GUILayoutOption[])(object)new GUILayoutOption[2]
{
GUILayout.Width(150f),
GUILayout.Height(25f)
}))
{
DeleteAimedItem();
}
GUI.backgroundColor = Color.white;
GUILayout.EndHorizontal();
GUILayout.Space(10f);
scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUI.skin.box);
bool flag = !string.IsNullOrEmpty(activeSearchQuery);
string[] array = new string[5] { "Food", "Weapons", "Tools", "Armor", "Fishing" };
string[] array2 = array;
foreach (string text in array2)
{
List<string> list = categorizedItems[text];
List<string> list2 = list.Where((string text3) => text3.ToLower().Contains(activeSearchQuery.ToLower())).ToList();
if (list2.Count == 0)
{
continue;
}
if (!flag)
{
GUI.backgroundColor = new Color(0.3f, 0.5f, 0.9f);
if (GUILayout.Button((categoryFolds[text] ? "[-] " : "[+] ") + text + " (" + list.Count + ")", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
{
categoryFolds[text] = !categoryFolds[text];
}
GUI.backgroundColor = Color.white;
}
if (!flag && !categoryFolds[text])
{
continue;
}
foreach (string item in list2)
{
GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
GUILayout.Space(20f);
string text2 = item.Replace("Item_", "");
GUILayout.Label(text2, (GUILayoutOption[])(object)new GUILayoutOption[2]
{
GUILayout.Width(250f),
GUILayout.Height(25f)
});
GUI.backgroundColor = new Color(0.2f, 0.7f, 0.8f);
if (GUILayout.Button("Spawn", (GUILayoutOption[])(object)new GUILayoutOption[2]
{
GUILayout.Width(100f),
GUILayout.Height(25f)
}))
{
AttemptSpawn(item);
}
GUI.backgroundColor = Color.white;
GUILayout.EndHorizontal();
}
GUILayout.Space(5f);
}
GUILayout.EndScrollView();
}
private string GetPlayerName(GameObject go, NetworkObject no)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
PlayerRef val;
int playerId;
if (!no.HasInputAuthority)
{
val = no.StateAuthority;
playerId = ((PlayerRef)(ref val)).PlayerId;
}
else
{
val = no.InputAuthority;
playerId = ((PlayerRef)(ref val)).PlayerId;
}
int num = playerId;
string result = "Player " + num;
foreach (Component component in go.GetComponents<Component>())
{
if ((Object)(object)component == (Object)null)
{
continue;
}
Type il2CppType = ((Object)component).GetIl2CppType();
try
{
PropertyInfo val2 = il2CppType.GetProperty("PlayerName") ?? il2CppType.GetProperty("SteamName") ?? il2CppType.GetProperty("UserName");
if (val2 != (PropertyInfo)null && ((MemberInfo)val2.PropertyType).Name == "String")
{
Object value = val2.GetValue((Object)(object)component);
if (value != null)
{
return value.ToString();
}
}
}
catch
{
}
}
return result;
}
private void KickPlayer(NetworkObject no)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
try
{
NetworkRunner val = Object.FindObjectOfType<NetworkRunner>();
if ((Object)(object)val != (Object)null)
{
MethodInfo method = ((Object)val).GetIl2CppType().GetMethod("Disconnect");
if (method != (MethodInfo)null)
{
Object[] array = new Object[1];
PlayerRef inputAuthority = no.InputAuthority;
array[0] = ((PlayerRef)(ref inputAuthority)).BoxIl2CppObject();
((MethodBase)method).Invoke((Object)(object)val, Il2CppReferenceArray<Object>.op_Implicit((Object[])(object)array));
}
}
}
catch
{
}
}
private void BanPlayer(NetworkObject no, string pName)
{
if (!banList.Contains(pName))
{
banList.Add(pName);
SaveBanList();
}
KickPlayer(no);
}
private void HealSpecificPlayer(GameObject go)
{
foreach (Component component in go.GetComponents<Component>())
{
if ((Object)(object)component == (Object)null)
{
continue;
}
try
{
PropertyInfo property = ((Object)component).GetIl2CppType().GetProperty("MaxHealth");
PropertyInfo property2 = ((Object)component).GetIl2CppType().GetProperty("CurrentHealth");
if (property != (PropertyInfo)null && property2 != (PropertyInfo)null)
{
property2.SetValue((Object)(object)component, property.GetValue((Object)(object)component));
}
}
catch
{
}
}
}
private void DrawPlayersTab()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0271: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_036d: Unknown result type (might be due to invalid IL or missing references)
//IL_0372: Unknown result type (might be due to invalid IL or missing references)
//IL_0380: Expected O, but got Unknown
//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
//IL_040a: Unknown result type (might be due to invalid IL or missing references)
GUILayout.Label("Active Players:", new GUIStyle(GUI.skin.label)
{
fontStyle = (FontStyle)1
}, (Il2CppReferenceArray<GUILayoutOption>)null);
GUILayout.Space(5f);
Il2CppArrayBase<MonoBehaviour> val = Object.FindObjectsOfType<MonoBehaviour>();
List<MonoBehaviour> list = new List<MonoBehaviour>();
foreach (MonoBehaviour item in val)
{
if (((MemberInfo)((Object)item).GetIl2CppType()).Name == "PlayerCharacter")
{
list.Add(item);
}
}
playersScrollPosition = GUILayout.BeginScrollView(playersScrollPosition, GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(180f) });
foreach (MonoBehaviour item2 in list)
{
GameObject gameObject = ((Component)item2).gameObject;
NetworkObject component = gameObject.GetComponent<NetworkObject>();
if ((Object)(object)component == (Object)null)
{
continue;
}
string playerName = GetPlayerName(gameObject, component);
float num = 0f;
float num2 = 100f;
foreach (Component component2 in gameObject.GetComponents<Component>())
{
if ((Object)(object)component2 == (Object)null)
{
continue;
}
Type il2CppType = ((Object)component2).GetIl2CppType();
try
{
PropertyInfo property = il2CppType.GetProperty("CurrentHealth");
PropertyInfo property2 = il2CppType.GetProperty("MaxHealth");
if (property != (PropertyInfo)null)
{
num = ((Il2CppObjectBase)property.GetValue((Object)(object)component2)).Unbox<float>();
}
if (property2 != (PropertyInfo)null)
{
num2 = ((Il2CppObjectBase)property2.GetValue((Object)(object)component2)).Unbox<float>();
}
}
catch
{
}
}
GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
GUILayout.Label(playerName + " - HP: " + Mathf.RoundToInt(num) + "/" + Mathf.RoundToInt(num2), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
GUI.backgroundColor = Color.green;
if (GUILayout.Button("Heal", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }))
{
HealSpecificPlayer(gameObject);
}
if (!component.HasStateAuthority)
{
GUI.backgroundColor = Color.yellow;
if (GUILayout.Button("Kick", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }))
{
KickPlayer(component);
}
GUI.backgroundColor = Color.red;
if (GUILayout.Button("Ban", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }))
{
BanPlayer(component, playerName);
}
}
else
{
GUI.backgroundColor = Color.gray;
GUILayout.Label(" [HOST]", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(125f) });
}
GUI.backgroundColor = Color.white;
GUILayout.EndHorizontal();
GUILayout.Space(5f);
}
GUILayout.EndScrollView();
GUILayout.Space(10f);
GUILayout.Label("Ban List:", new GUIStyle(GUI.skin.label)
{
fontStyle = (FontStyle)1
}, (Il2CppReferenceArray<GUILayoutOption>)null);
foreach (string item3 in banList.ToList())
{
GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
GUILayout.Label(item3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
GUI.backgroundColor = Color.gray;
if (GUILayout.Button("Unban", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
{
banList.Remove(item3);
SaveBanList();
}
GUI.backgroundColor = Color.white;
GUILayout.EndHorizontal();
}
}
private GameObject GetPrefabIntelligently(string itemName)
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
Il2CppArrayBase<NetworkObject> val = Resources.FindObjectsOfTypeAll<NetworkObject>();
Scene scene;
foreach (NetworkObject item in val)
{
if (((Object)item).name.Equals(itemName, StringComparison.OrdinalIgnoreCase) || ((Object)item).name.Equals(itemName + "(Clone)", StringComparison.OrdinalIgnoreCase))
{
scene = ((Component)item).gameObject.scene;
if (((Scene)(ref scene)).rootCount == 0)
{
return ((Component)item).gameObject;
}
}
}
Il2CppArrayBase<ScriptableObject> val2 = Resources.FindObjectsOfTypeAll<ScriptableObject>();
foreach (ScriptableObject item2 in val2)
{
if (!((Object)item2).name.Equals(itemName, StringComparison.OrdinalIgnoreCase))
{
continue;
}
try
{
foreach (PropertyInfo item3 in (Il2CppArrayBase<PropertyInfo>)(object)((Object)item2).GetIl2CppType().GetProperties())
{
if (((MemberInfo)item3.PropertyType).Name == "GameObject")
{
Object value = item3.GetValue((Object)(object)item2);
if (value != null)
{
return ((Il2CppObjectBase)value).Cast<GameObject>();
}
}
else if (((MemberInfo)item3.PropertyType).Name == "NetworkObject")
{
Object value2 = item3.GetValue((Object)(object)item2);
if (value2 != null)
{
return ((Component)((Il2CppObjectBase)value2).Cast<NetworkObject>()).gameObject;
}
}
}
foreach (FieldInfo item4 in (Il2CppArrayBase<FieldInfo>)(object)((Object)item2).GetIl2CppType().GetFields())
{
if (((MemberInfo)item4.FieldType).Name == "GameObject")
{
Object value3 = item4.GetValue((Object)(object)item2);
if (value3 != null)
{
return ((Il2CppObjectBase)value3).Cast<GameObject>();
}
}
else if (((MemberInfo)item4.FieldType).Name == "NetworkObject")
{
Object value4 = item4.GetValue((Object)(object)item2);
if (value4 != null)
{
return ((Component)((Il2CppObjectBase)value4).Cast<NetworkObject>()).gameObject;
}
}
}
}
catch
{
}
}
string text = itemName;
if (itemName.Contains("_"))
{
text = itemName.Split('_')[^1];
}
foreach (NetworkObject item5 in val)
{
if (((Object)item5).name.Equals(text, StringComparison.OrdinalIgnoreCase) || ((Object)item5).name.Equals(text + "(Clone)", StringComparison.OrdinalIgnoreCase))
{
scene = ((Component)item5).gameObject.scene;
if (((Scene)(ref scene)).rootCount == 0)
{
return ((Component)item5).gameObject;
}
}
}
return Resources.Load<GameObject>(itemName);
}
private void AttemptSpawn(string itemName)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
try
{
GameObject prefabIntelligently = GetPrefabIntelligently(itemName);
if ((Object)(object)prefabIntelligently == (Object)null)
{
return;
}
Vector3 val = Vector3.zero;
Il2CppArrayBase<MonoBehaviour> val2 = Object.FindObjectsOfType<MonoBehaviour>();
foreach (MonoBehaviour item in val2)
{
if (((MemberInfo)((Object)item).GetIl2CppType()).Name == "PlayerCharacter")
{
NetworkObject component = ((Component)item).gameObject.GetComponent<NetworkObject>();
if ((Object)(object)component != (Object)null && (component.HasInputAuthority || component.HasStateAuthority))
{
val = ((Component)item).transform.position + ((Component)item).transform.forward * 2f + Vector3.up * 1f;
break;
}
}
}
if (val == Vector3.zero && (Object)(object)Camera.main != (Object)null)
{
val = ((Component)Camera.main).transform.position + ((Component)Camera.main).transform.forward * 2f + Vector3.up * 1f;
}
NetworkObject val3 = prefabIntelligently.GetComponent<NetworkObject>();
if ((Object)(object)val3 == (Object)null)
{
val3 = prefabIntelligently.GetComponentInChildren<NetworkObject>(true);
}
if ((Object)(object)val3 != (Object)null)
{
NetworkRunner val4 = Object.FindObjectOfType<NetworkRunner>();
if ((Object)(object)val4 != (Object)null)
{
Nullable<Vector3> val5 = new Nullable<Vector3>(val);
Nullable<Quaternion> val6 = new Nullable<Quaternion>(Quaternion.identity);
try
{
val4.Spawn(val3, val5, val6, (Nullable<PlayerRef>)null, (OnBeforeSpawned)null, (Nullable<NetworkObjectPredictionKey>)null, true);
return;
}
catch
{
}
}
}
Object.Instantiate<GameObject>(prefabIntelligently, val, Quaternion.identity);
}
catch
{
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "AskaAdminMenu";
public const string PLUGIN_NAME = "AskaAdminMenu";
public const string PLUGIN_VERSION = "1.0.0";
}