Guest User

password protected servers

a guest
Dec 25th, 2019
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. From da9309e10bc214e0fef52409500bb8192c68cafe Mon Sep 17 00:00:00 2001
  2. From: NegativeOne
  3. Date: Wed, 25 Dec 2019 12:35:50 +0100
  4. Subject: [PATCH] Support password protected servers
  5.  
  6. ---
  7. S2Lobby/LobbyProcessor.cs | 13 +++++++++++++
  8.  S2Lobby/Servers.cs        |  1 +
  9.  2 files changed, 14 insertions(+)
  10.  
  11. diff --git a/S2Lobby/LobbyProcessor.cs b/S2Lobby/LobbyProcessor.cs
  12. index 9126ab8..d08032b 100644
  13. --- a/S2Lobby/LobbyProcessor.cs
  14. +++ b/S2Lobby/LobbyProcessor.cs
  15. @@ -346,6 +346,10 @@ namespace S2Lobby
  16.              _server.Running = payload.Running;
  17.              _server.LockedConfig = payload.LockedConfig;
  18.              _server.Data = payload.Data;
  19. +            if (payload.Cipher != null)
  20. +            {
  21. +                _server.NeedsPassword = true;
  22. +            }
  23.  
  24.              SendServerUpdates();
  25.  
  26. @@ -411,6 +415,7 @@ namespace S2Lobby
  27.              resultPayload1.Running = server.Running;
  28.              resultPayload1.LockedConfig = server.LockedConfig;
  29.              resultPayload1.Data = server.Data; // Crypto.BytesFromHexString("25000000785e63607264d26567c00f001041007a");
  30. +            resultPayload1.PasswordRequired = server.NeedsPassword;
  31.              resultPayload1.TicketId = ticketId;
  32.              return resultPayload1;
  33.          }
  34. @@ -508,6 +513,14 @@ namespace S2Lobby
  35.              _server.Running = payload.Running;
  36.              _server.LockedConfig = payload.LockedConfig;
  37.              _server.Data = payload.Data;
  38. +            if (payload.Cipher == null)
  39. +            {
  40. +                _server.NeedsPassword = false;
  41. +            }
  42. +            else
  43. +            {
  44. +                _server.NeedsPassword = true;
  45. +            }
  46.  
  47.              SendServerUpdates();
  48.  
  49. diff --git a/S2Lobby/Servers.cs b/S2Lobby/Servers.cs
  50. index 81d31d0..013a9d8 100644
  51. --- a/S2Lobby/Servers.cs
  52. +++ b/S2Lobby/Servers.cs
  53. @@ -92,5 +92,6 @@ namespace S2Lobby
  54.          public bool Running;
  55.          public bool LockedConfig;
  56.          public byte[] Data;
  57. +        public bool NeedsPassword;
  58.      }
  59.  }
  60. --
RAW Paste Data