Exemplo n.º 1
0
        private void onChat(SteamPlayer player, EChatMode mode, ref Color chatted, ref bool isRich, string text, ref bool isVisible)
        {
            var converted = UnturnedPlayer.FromSteamPlayer(player);

            var webhook = Configuration.Instance.DiscordWebHookLink;

            var lower = text.ToLower();

            var ip = SteamGameServer.GetPublicIP();

            var address = ip.ToString();

            if (Configuration.Instance.LogCommands.Any(w => lower.StartsWith($"/{w.name} ")))
            {
                if (webhook == "Discord Webhook Here")
                {
                    return;
                }
                sendDiscordWebhook(webhook, ("{  \"username\": \"Command Log\",  \"avatar_url\": \"https://i.imgur.com/4M34hi2.png\",  \"embeds\": [    {      \"title\": \"Command Executed\",      \"color\": 15258703,      \"fields\": [        {          \"name\": \"Executer - !executer!\",          \"value\": \"ExecuterID\",          \"inline\": true        },        {          \"name\": \"Command:\",          \"value\": \"*!args!*\"        },        {          \"name\": \"Server IP\",          \"value\": \"!ip!\"        }      ],      \"thumbnail\": {        \"url\": \"https://i.pinimg.com/originals/1b/e8/41/1be84116e72d71bd6785c7050fefd2e3.gif\"      },      \"image\": {        \"url\": \"https://upload.wikimedia.org/wikipedia/commons/5/5a/A_picture_from_China_every_day_108.jpg\"      },      \"footer\": {        \"text\": \"CommandLog by ExoPlugins\",        \"icon_url\": \"https://media.discordapp.net/attachments/811275497966665739/823878043906080778/image0.png?width=128&height=128\"      }    }  ]}").Replace("!executer!", converted.DisplayName).Replace("*!args!*", $"`{lower}`").Replace("!ip!", address).Replace("ExecuterID", converted.Id));
            }

            else if (Configuration.Instance.LogCommands.Any(w => lower.StartsWith($"/{w.name}")))
            {
                if (webhook == "Discord Webhook Here")
                {
                    return;
                }
                sendDiscordWebhook(webhook, ("{  \"username\": \"Command Log\",  \"avatar_url\": \"https://i.imgur.com/4M34hi2.png\",  \"embeds\": [    {      \"title\": \"Command Executed\",      \"color\": 15258703,      \"fields\": [        {          \"name\": \"Executer - !executer!\",          \"value\": \"ExecuterID\",          \"inline\": true        },        {          \"name\": \"Command:\",          \"value\": \"*!args!*\"        },        {          \"name\": \"Server IP\",          \"value\": \"!ip!\"        }      ],      \"thumbnail\": {        \"url\": \"https://i.pinimg.com/originals/1b/e8/41/1be84116e72d71bd6785c7050fefd2e3.gif\"      },      \"image\": {        \"url\": \"https://upload.wikimedia.org/wikipedia/commons/5/5a/A_picture_from_China_every_day_108.jpg\"      },      \"footer\": {        \"text\": \"CommandLog by ExoPlugins\",        \"icon_url\": \"https://media.discordapp.net/attachments/811275497966665739/823878043906080778/image0.png?width=128&height=128\"      }    }  ]}").Replace("!executer!", converted.DisplayName).Replace("*!args!*", $"`{lower}`").Replace("!ip!", address).Replace("ExecuterID", converted.Id));
            }
        }
    void OnLobbyCreated(LobbyCreated_t result)
    {
        if (result.m_eResult == EResult.k_EResultOK)
        {
            Debug.Log("Lobby created -- SUCCESS!");
        }
        else
        {
            Debug.Log("Lobby created -- failure ...");
            return;
        }
        uint   serverIp = SteamGameServer.GetPublicIP();
        int    ipaddr   = System.Net.IPAddress.HostToNetworkOrder((int)serverIp);
        string ip       = new System.Net.IPAddress(BitConverter.GetBytes(ipaddr)).ToString();

        SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "ServerIP", ip);
        isHost        = true;
        awaitMsg.text = "";
        StartHost();
    }
Exemplo n.º 3
0
 protected override void execute(CSteamID executorID, string parameter)
 {
     if (!Dedicator.isDedicated)
     {
         return;
     }
     if (!Provider.isServer)
     {
         CommandWindow.LogError(this.localization.format("NotRunningErrorText"));
         return;
     }
     CommandWindow.Log(this.localization.format("DebugText"));
     CommandWindow.Log(this.localization.format("DebugIPPortText", new object[]
     {
         SteamGameServer.GetSteamID(),
         Parser.getIPFromUInt32(SteamGameServer.GetPublicIP()),
         Provider.port
     }));
     CommandWindow.Log(this.localization.format("DebugBytesSentText", new object[]
     {
         Provider.bytesSent + "B"
     }));
     CommandWindow.Log(this.localization.format("DebugBytesReceivedText", new object[]
     {
         Provider.bytesReceived + "B"
     }));
     CommandWindow.Log(this.localization.format("DebugAverageBytesSentText", new object[]
     {
         (uint)(Provider.bytesSent / Time.realtimeSinceStartup) + "B"
     }));
     CommandWindow.Log(this.localization.format("DebugAverageBytesReceivedText", new object[]
     {
         (uint)(Provider.bytesReceived / Time.realtimeSinceStartup) + "B"
     }));
     CommandWindow.Log(this.localization.format("DebugPacketsSentText", new object[]
     {
         Provider.packetsSent
     }));
     CommandWindow.Log(this.localization.format("DebugPacketsReceivedText", new object[]
     {
         Provider.packetsReceived
     }));
     CommandWindow.Log(this.localization.format("DebugAveragePacketsSentText", new object[]
     {
         (uint)(Provider.packetsSent / Time.realtimeSinceStartup)
     }));
     CommandWindow.Log(this.localization.format("DebugAveragePacketsReceivedText", new object[]
     {
         (uint)(Provider.packetsReceived / Time.realtimeSinceStartup)
     }));
     CommandWindow.Log(this.localization.format("DebugUPSText", new object[]
     {
         Mathf.CeilToInt((float)Provider.debugUPS / 50f * 100f)
     }));
     CommandWindow.Log(this.localization.format("DebugTPSText", new object[]
     {
         Mathf.CeilToInt((float)Provider.debugTPS / 50f * 100f)
     }));
     CommandWindow.Log(this.localization.format("DebugZombiesText", new object[]
     {
         ZombieManager.tickingZombies.Count
     }));
     CommandWindow.Log(this.localization.format("DebugAnimalsText", new object[]
     {
         AnimalManager.tickingAnimals.Count
     }));
 }
Exemplo n.º 4
0
 public static IPAddress GetSteamServerPublicIp()
 {
     return(NetworkHelper.ToAddr(SteamGameServer.GetPublicIP()));
 }
Exemplo n.º 5
0
 public uint GetPublicIP()
 {
     return(SteamGameServer.GetPublicIP());
 }
Exemplo n.º 6
0
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            CommandWindow.Log(Translations["Debug_Title"]);
            CommandWindow.Log(string.Format(Translations["Debug_SteamID"], SteamGameServer.GetSteamID()));
            CommandWindow.Log(string.Format(Translations["Debug_IP"], Parser.getIPFromUInt32(SteamGameServer.GetPublicIP())));
            CommandWindow.Log(string.Format(Translations["Debug_Port"], Provider.port));

            CommandWindow.Log(string.Format(Translations["Debug_BytesSent"], Provider.bytesSent));
            CommandWindow.Log(string.Format(Translations["Debug_BytesReceived"], Provider.bytesReceived));

            CommandWindow.Log(string.Format(Translations["Debug_ABytesSent"], (uint)(Provider.bytesSent / Time.realtimeSinceStartup)));
            CommandWindow.Log(string.Format(Translations["Debug_ABytesReceived"], (uint)(Provider.bytesReceived / Time.realtimeSinceStartup)));

            CommandWindow.Log(string.Format(Translations["Debug_PacketsSent"], Provider.packetsSent));
            CommandWindow.Log(string.Format(Translations["Debug_PacketsReceived"], Provider.packetsReceived));

            CommandWindow.Log(string.Format(Translations["Debug_APacketsSent"], (uint)(Provider.packetsSent / Time.realtimeSinceStartup)));
            CommandWindow.Log(string.Format(Translations["Debug_APacketsReceived"], (uint)(Provider.packetsReceived / Time.realtimeSinceStartup)));

            CommandWindow.Log(string.Format(Translations["Debug_UPS"], Mathf.CeilToInt(Provider.debugUPS / 50f * 100f)));
            CommandWindow.Log(string.Format(Translations["Debug_TPS"], Mathf.CeilToInt((Provider.debugTPS / 50f * 100f))));

            CommandWindow.Log(string.Format(Translations["Debug_Zombies"], ZombieManager.tickingZombies.Count));
            CommandWindow.Log(string.Format(Translations["Debug_Animals"], AnimalManager.tickingAnimals.Count));
        }