using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using BepInEx.Configuration;
using Landfall.Network.Sockets;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("StickFightTheGameMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StickFightTheGameMod")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("07ad7751-658e-41ea-b1ee-8a7e59ffbe73")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HostKickMenu;
[BepInPlugin("sftg.bayturtleking.kickpeople", "Kick Menu", "1.0.0")]
public class HostKickMenuPlugin : BaseUnityPlugin
{
private struct clientrow
{
public int iiiiiii;
public string nameeee;
public string pingpong;
public bool localare;
}
private const int windowid = 837462;
private ConfigEntry<KeyCode> theconfigpart;
private bool showmenu;
private Rect windowrect = new Rect(20f, 20f, 280f, 240f);
private MultiplayerManager managstreammmm;
private MultiplayerManagerSockets managgsoxket;
private float refreshhhhh;
private void Awake()
{
theconfigpart = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "menukey", (KeyCode)282, "the key that opens the kick menu (host only)");
}
private void Update()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(theconfigpart.Value))
{
showmenu = !showmenu;
}
refreshhhhh -= Time.unscaledDeltaTime;
if (refreshhhhh <= 0f)
{
refreshhhhh = 1f;
managstuffff();
}
}
private void managstuffff()
{
if (MatchmakingHandler.RunningOnSockets)
{
if ((Object)(object)managgsoxket == (Object)null)
{
managgsoxket = Object.FindObjectOfType<MultiplayerManagerSockets>();
}
managstreammmm = null;
}
else
{
if ((Object)(object)managstreammmm == (Object)null)
{
managstreammmm = Object.FindObjectOfType<MultiplayerManager>();
}
managgsoxket = null;
}
}
private static bool arehost()
{
if (MatchmakingHandler.RunningOnSockets)
{
return MultiplayerManagerSockets.IsServer;
}
return MultiplayerManager.IsServer;
}
private List<clientrow> finddarows()
{
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
List<clientrow> list = new List<clientrow>();
if (MatchmakingHandler.RunningOnSockets)
{
if ((Object)(object)managgsoxket == (Object)null)
{
return list;
}
ConnectedClientData[] connectedClients = managgsoxket.ConnectedClients;
for (int i = 0; i < connectedClients.Length; i++)
{
ConnectedClientData val = connectedClients[i];
if (val != null && val.ClientSocketID != null)
{
list.Add(new clientrow
{
iiiiiii = i,
nameeee = val.PlayerName,
pingpong = val.Ping,
localare = val.ControlledLocally
});
}
}
}
else
{
if ((Object)(object)managstreammmm == (Object)null)
{
return list;
}
ConnectedClientData[] connectedClients2 = managstreammmm.ConnectedClients;
for (int j = 0; j < connectedClients2.Length; j++)
{
ConnectedClientData val2 = connectedClients2[j];
if (val2 != null && !(val2.ClientID == managstreammmm.mUnassignedID))
{
list.Add(new clientrow
{
iiiiiii = j,
nameeee = val2.PlayerName,
pingpong = val2.Ping,
localare = val2.ControlledLocally
});
}
}
}
return list;
}
private void kickindex(int index)
{
if (MatchmakingHandler.RunningOnSockets)
{
MultiplayerManagerSockets obj = managgsoxket;
if (obj != null)
{
obj.KickPlayer((ushort)index, (KickResponse)1);
}
}
else
{
MultiplayerManager obj2 = managstreammmm;
if (obj2 != null)
{
obj2.KickPlayer((ushort)index, (KickResponse)1);
}
}
}
private void OnGUI()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
if (showmenu && arehost())
{
windowrect = GUILayout.Window(837462, windowrect, new WindowFunction(makewin), "(host only) Kick players", (GUILayoutOption[])(object)new GUILayoutOption[0]);
}
}
private void makewin(int id)
{
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
List<clientrow> list = finddarows();
GUILayout.Label("other players: " + list.Count, (GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.Space(4f);
foreach (clientrow item in list)
{
if (!item.localare)
{
GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.Label(item.nameeee + " (" + item.pingpong + ")", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(170f) });
if (GUILayout.Button("Kick", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }))
{
kickindex(item.iiiiiii);
}
GUILayout.EndHorizontal();
}
}
if (list.Count == 0)
{
GUILayout.Label("no other players ingame", (GUILayoutOption[])(object)new GUILayoutOption[0]);
}
GUILayout.Space(8f);
if (GUILayout.Button("Close", (GUILayoutOption[])(object)new GUILayoutOption[0]))
{
showmenu = false;
}
GUI.DragWindow(new Rect(0f, 0f, 10000f, 20f));
}
}