Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Decompiled with JetBrains decompiler
- // Type: Rust.Steam.Server
- // Assembly: Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
- // MVID: A19F68F2-120B-446D-8122-2A833E59C2DD
- // Assembly location: C:\Users\luke\Desktop\oxide2\rust_server_Data\Managed\Assembly-CSharp.dll
- using Oxide.Core;
- using System;
- using System.Runtime.InteropServices;
- using UnityEngine;
- namespace Rust.Steam
- {
- public static class Server
- {
- public static GCHandle UserAuthGC;
- public static GCHandle UserGroupGC;
- public static bool Modded;
- public static bool Official;
- public static ulong SteamID;
- public static uint IPAddress;
- public static ulong SteamGroup;
- public static void Init()
- {
- if (!Server.Steam_ServerStartup(NetCull.listenPort, 1069))
- {
- Application.Quit();
- }
- else
- {
- Server.funcUserAuth fnc1 = new Server.funcUserAuth(Server.OnUserAuth);
- Server.UserAuthGC = GCHandle.Alloc((object) fnc1);
- Server.SteamServer_SetCallback_UserAuth(fnc1);
- Server.funcUserGroup fnc2 = new Server.funcUserGroup(Server.OnUserGroup);
- Server.UserGroupGC = GCHandle.Alloc((object) fnc2);
- Server.SteamServer_SetCallback_UserGroup(fnc2);
- Server.SteamID = Server.SteamServer_GetSteamID();
- Server.IPAddress = Server.SteamServer_GetPublicIP();
- }
- }
- public static void Shutdown()
- {
- Server.Steam_ServerShutdown();
- }
- public static void OnUserAuth(ulong iUserID, [MarshalAs(UnmanagedType.LPStr), In] string strStatus)
- {
- ConnectionAcceptor.OnSteamAuthorization(iUserID, strStatus);
- }
- public static void OnUserGroup(ulong iUserID, ulong iGroupID, [MarshalAs(UnmanagedType.LPStr), In] string strStatus)
- {
- ConnectionAcceptor.OnSteamOnUserGroup(iUserID, iGroupID, strStatus);
- }
- public static bool StartUserAuth(ulong iUserID, byte[] data)
- {
- // ISSUE: unable to decompile the method.
- }
- public static void OnUserLeave(ulong iUserID)
- {
- Server.SteamServer_UserLeave(iUserID);
- Server.OnPlayerCountChanged();
- }
- public static void UpdateServerTitle()
- {
- Server.SetTitleOfConsole(NetCull.connections.Length.ToString() + " | " + server.hostname);
- }
- public static void OnPlayerCountChanged()
- {
- Server.Steam_UpdateServer(NetCull.maxConnections, NetCull.connections.Length, server.hostname, server.map, Server.GetTags());
- Server.UpdateServerTitle();
- }
- public static string GetTags()
- {
- string str = "rust";
- if (Server.Modded)
- str += ",modded";
- if (Server.Official)
- str += ",official";
- if ((long) Server.SteamGroup != 0L)
- str = str + ",sg:" + Server.SteamGroup.ToString("X");
- object obj = Interface.CallHook("ModifyTags", (object) str);
- if (obj is string)
- str = (string) obj;
- return str;
- }
- public static void SetModded()
- {
- Server.Modded = false;
- }
- public static void SetOfficial()
- {
- Server.Official = true;
- }
- [DllImport("librust")]
- public static extern IntPtr SteamServer_BeginAuthSession(IntPtr pData, int iDataSize, ulong iUserID);
- [DllImport("librust")]
- public static extern bool SteamServer_UserGroupStatus(ulong iUserID, ulong iGroupID);
- [DllImport("librust")]
- public static extern void SteamServer_UserLeave(ulong iUserID);
- [DllImport("librust")]
- public static extern void SteamServer_SetCallback_UserAuth(Server.funcUserAuth fnc);
- [DllImport("librust")]
- public static extern void SteamServer_SetCallback_UserGroup(Server.funcUserGroup fnc);
- [DllImport("librust")]
- public static extern bool Steam_ServerStartup(int port, int protocol);
- [DllImport("librust")]
- public static extern void Steam_ServerShutdown();
- [DllImport("librust")]
- public static extern void SetTitleOfConsole(string log);
- [DllImport("librust")]
- public static extern void Steam_UpdateServer(int maxplayers, int icurrentplayers, string strServerName, string strMapName, string strTags);
- [DllImport("librust")]
- public static extern ulong SteamServer_GetSteamID();
- [DllImport("librust")]
- public static extern uint SteamServer_GetPublicIP();
- public delegate void funcUserAuth(ulong iUserID, [MarshalAs(UnmanagedType.LPStr), In] string strStatus);
- public delegate void funcUserGroup(ulong iUserID, ulong iGroupID, [MarshalAs(UnmanagedType.LPStr), In] string strStatus);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement