public MainPage() { InitializeComponent(); //lbl.BindingContext = DevInfo; Devs = new DeveloperList(); Devs.Add(new DeveloperInfo() { Name = "Trudy" }); Devs.Add(new DeveloperInfo() { Name = "Andy" }); Devs.Add(new DeveloperInfo() { Name = "Sue" }); Devs.Add(new DeveloperInfo() { Name = "John" }); BindingContext = this; }
public void JoinGame(Network.Connection connection) { using (Approval approval = (Approval)Pool.Get <Approval>()) { uint num = (uint)ConVar.Server.encryption; if (num > 1U && (string)connection.os == "editor" && DeveloperList.Contains((ulong)connection.ownerid)) { num = 1U; } approval.level = (__Null)Application.get_loadedLevelName(); approval.levelUrl = (__Null)World.Url; approval.levelSeed = (__Null)(int)World.Seed; approval.levelSize = (__Null)(int)World.Size; approval.checksum = (__Null)World.Checksum; approval.hostname = (__Null)ConVar.Server.hostname; approval.official = (__Null)(ConVar.Server.official ? 1 : 0); approval.encryption = (__Null)(int)num; if (((Write)((NetworkPeer)Network.Net.sv).write).Start()) { ((Write)((NetworkPeer)Network.Net.sv).write).PacketID((Message.Type) 3); approval.WriteToStream((Stream)((NetworkPeer)Network.Net.sv).write); ((Write)((NetworkPeer)Network.Net.sv).write).Send(new SendInfo(connection)); } connection.encryptionLevel = (__Null)(int)num; connection.encryptOutgoing = (__Null)1; } connection.connected = (__Null)1; }
public async Task <IActionResult> PutDeveloperList(int id, DeveloperList developerList) { if (id != developerList.Id) { return(BadRequest()); } _context.Entry(developerList).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeveloperListExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void JoinGame(Network.Connection connection) { using (Approval url = Facepunch.Pool.Get <Approval>()) { uint num = (uint)ConVar.Server.encryption; if (num > 1 && connection.os == "editor" && DeveloperList.Contains(connection.ownerid)) { num = 1; } url.level = UnityEngine.Application.loadedLevelName; url.levelUrl = World.Url; url.levelSeed = World.Seed; url.levelSize = World.Size; url.checksum = World.Checksum; url.hostname = ConVar.Server.hostname; url.official = ConVar.Server.official; url.encryption = num; if (Network.Net.sv.write.Start()) { Network.Net.sv.write.PacketID(Message.Type.Approved); url.WriteToStream(Network.Net.sv.write); Network.Net.sv.write.Send(new SendInfo(connection)); } connection.encryptionLevel = num; connection.encryptOutgoing = true; } connection.connected = true; }
public static bool IsDeveloper(BasePlayer ply) { if (Object.op_Inequality((Object)ply, (Object)null)) { return(DeveloperList.Contains(ply.userID)); } return(false); }
public static bool IsDeveloper(BasePlayer ply) { if (ply == null) { return(false); } return(DeveloperList.Contains(ply.userID)); }
public async Task <ActionResult <DeveloperList> > PostDeveloperList(DeveloperList developerList) { Console.WriteLine(developerList.Mobile); _context.DeveloperLists.Add(developerList); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDeveloperList", new { id = developerList.Id }, developerList)); }
public void OnNewConnection(Connection connection) { connection.connected = false; if (connection.token == null || (int)connection.token.Length < 32) { ConnectionAuth.Reject(connection, "Invalid Token"); return; } if (connection.userid == 0) { ConnectionAuth.Reject(connection, "Invalid SteamID"); return; } if (connection.protocol != 2177) { if (!DeveloperList.Contains(connection.userid)) { ConnectionAuth.Reject(connection, "Incompatible Version"); return; } DebugEx.Log(string.Concat("Not kicking ", connection.userid, " for incompatible protocol (is a developer)"), StackTraceLogType.None); } if (ServerUsers.Is(connection.userid, ServerUsers.UserGroup.Banned)) { ConnectionAuth.Reject(connection, "You are banned from this server"); return; } if (ServerUsers.Is(connection.userid, ServerUsers.UserGroup.Moderator)) { DebugEx.Log(string.Concat(connection.ToString(), " has auth level 1"), StackTraceLogType.None); connection.authLevel = 1; } if (ServerUsers.Is(connection.userid, ServerUsers.UserGroup.Owner)) { DebugEx.Log(string.Concat(connection.ToString(), " has auth level 2"), StackTraceLogType.None); connection.authLevel = 2; } if (DeveloperList.Contains(connection.userid)) { DebugEx.Log(string.Concat(connection.ToString(), " is a developer"), StackTraceLogType.None); connection.authLevel = 3; } if (this.IsConnected(connection.userid)) { ConnectionAuth.Reject(connection, "You are already connected!"); return; } if (Interface.CallHook("IOnUserApprove", connection) != null) { return; } ConnectionAuth.m_AuthConnection.Add(connection); base.StartCoroutine(this.AuthorisationRoutine(connection)); }
public void OnNewConnection(Connection connection) { connection.connected = false; if (connection.token == null || connection.token.Length < 32) { Reject(connection, "Invalid Token"); return; } if (connection.userid == 0L) { Reject(connection, "Invalid SteamID"); return; } if (connection.protocol != 2306) { if (!DeveloperList.Contains(connection.userid)) { Reject(connection, "Incompatible Version"); return; } DebugEx.Log("Not kicking " + connection.userid + " for incompatible protocol (is a developer)"); } if (ServerUsers.Is(connection.userid, ServerUsers.UserGroup.Banned)) { ServerUsers.User user = ServerUsers.Get(connection.userid); string text = user?.notes ?? "no reason given"; string text2 = ((user != null && user.expiry > 0) ? (" for " + (user.expiry - Epoch.Current).FormatSecondsLong()) : ""); Reject(connection, "You are banned from this server" + text2 + " (" + text + ")"); return; } if (ServerUsers.Is(connection.userid, ServerUsers.UserGroup.Moderator)) { DebugEx.Log(connection.ToString() + " has auth level 1"); connection.authLevel = 1u; } if (ServerUsers.Is(connection.userid, ServerUsers.UserGroup.Owner)) { DebugEx.Log(connection.ToString() + " has auth level 2"); connection.authLevel = 2u; } if (DeveloperList.Contains(connection.userid)) { DebugEx.Log(connection.ToString() + " is a developer"); connection.authLevel = 3u; } if (Interface.CallHook("IOnUserApprove", connection) == null) { m_AuthConnection.Add(connection); StartCoroutine(AuthorisationRoutine(connection)); } }
private bool CanJumpQueue(Connection connection) { object obj = Interface.CallHook("CanBypassQueue", (object)connection); if (obj is bool) { return((bool)obj); } if (DeveloperList.Contains((ulong)connection.userid)) { return(true); } ServerUsers.User user = ServerUsers.Get((ulong)connection.userid); return(user != null && user.group == ServerUsers.UserGroup.Moderator || user != null && user.group == ServerUsers.UserGroup.Owner); }
private void UnsetPropFlags(BasePlayer player) { // Change to normal view player.SetPlayerFlag(BasePlayer.PlayerFlags.ThirdPersonViewmode, false); player.SetPlayerFlag(BasePlayer.PlayerFlags.EyesViewmode, false); // Restore admin/developer flags if (player.net.connection.authLevel > 0) { player.SetPlayerFlag(BasePlayer.PlayerFlags.IsAdmin, true); } if (DeveloperList.IsDeveloper(player)) { player.SetPlayerFlag(BasePlayer.PlayerFlags.IsDeveloper, true); } }
public static List <ChatGroup> GetUserGroups(IPlayer player) { string[] oxideGroups = _instance.permission.GetUserGroups(player.Id); var groups = _instance._chatGroups.Where(g => oxideGroups.Any(name => g.GroupName.ToLower() == name)).ToList(); #if RUST BasePlayer bPlayer = BasePlayer.Find(player.Id); if (bPlayer.IsValid() && DeveloperList.Contains(bPlayer.userID)) { groups.Add(_rustDeveloperGroup); } #endif return(groups); }
void SetPropFlags(BasePlayer player) { // Toggle admin/developer flags to allow third-person if (player.net.connection.authLevel > 0) { player.SetPlayerFlag(BasePlayer.PlayerFlags.IsAdmin, false); } if (DeveloperList.IsDeveloper(player)) { player.SetPlayerFlag(BasePlayer.PlayerFlags.IsDeveloper, false); } // Toggle the third-person view player.SetPlayerFlag(BasePlayer.PlayerFlags.ThirdPersonViewmode, !player.HasPlayerFlag(BasePlayer.PlayerFlags.ThirdPersonViewmode)); onlinePlayers[player].IsHidden = !onlinePlayers[player].IsHidden; }
static bool Prefix(Connection connection) { if (DeveloperList.Contains(connection.userid)) { ConnectionAuth.Reject(connection, "Developer SteamId"); return(false); } var message = Interface.CallHook("CanNewConnection", connection, !ShouldIgnore(connection)); if (message != null) { ConnectionAuth.Reject(connection, message.ToString()); return(false); } return(true); }
internal static bool sayAs(ChatChannel targetChannel, ulong userId, string username, string message, BasePlayer player = null) { if (!player) { player = null; } if (!enabled) { return(false); } if (player != null && player.HasPlayerFlag(BasePlayer.PlayerFlags.ChatMute)) { return(false); } ServerUsers.UserGroup userGroup = ServerUsers.Get(userId)?.group ?? ServerUsers.UserGroup.None; if (userGroup == ServerUsers.UserGroup.Banned) { return(false); } string text = message.Replace("\n", "").Replace("\r", "").Trim(); if (text.Length > 128) { text = text.Substring(0, 128); } if (text.Length <= 0) { return(false); } if (text.StartsWith("/") || text.StartsWith("\\")) { Interface.CallHook("IOnPlayerCommand", player, message); return(false); } text = text.EscapeRichText(); object obj = Interface.CallHook("IOnPlayerChat", userId, username, text, targetChannel, player); if (obj is bool) { return((bool)obj); } if (serverlog) { ServerConsole.PrintColoured(ConsoleColor.DarkYellow, string.Concat("[", targetChannel, "] ", username, ": "), ConsoleColor.DarkGreen, text); string text2 = player?.ToString() ?? $"{username}[{userId}]"; switch (targetChannel) { case ChatChannel.Team: DebugEx.Log("[TEAM CHAT] " + text2 + " : " + text); break; case ChatChannel.Cards: DebugEx.Log("[CARDS CHAT] " + text2 + " : " + text); break; default: DebugEx.Log("[CHAT] " + text2 + " : " + text); break; } } bool flag = userGroup == ServerUsers.UserGroup.Owner || userGroup == ServerUsers.UserGroup.Moderator; bool num = ((player != null) ? player.IsDeveloper : DeveloperList.Contains(userId)); string text3 = "#5af"; if (flag) { text3 = "#af5"; } if (num) { text3 = "#fa5"; } string text4 = username.EscapeRichText(); ChatEntry chatEntry = default(ChatEntry); chatEntry.Channel = targetChannel; chatEntry.Message = text; chatEntry.UserId = ((player != null) ? player.UserIDString : userId.ToString()); chatEntry.Username = username; chatEntry.Color = text3; chatEntry.Time = Epoch.Current; ChatEntry chatEntry2 = chatEntry; History.Add(chatEntry2); RCon.Broadcast(RCon.LogType.Chat, chatEntry2); switch (targetChannel) { case ChatChannel.Cards: { if (player == null) { return(false); } if (!player.isMounted) { return(false); } CardTable cardTable = player.GetMountedVehicle() as CardTable; if (cardTable == null || !cardTable.GameController.PlayerIsInGame(player)) { return(false); } List <Network.Connection> obj2 = Facepunch.Pool.GetList <Network.Connection>(); cardTable.GameController.GetConnectionsInGame(obj2); if (obj2.Count > 0) { ConsoleNetwork.SendClientCommand(obj2, "chat.add2", 3, userId, text, text4, text3, 1f); } Facepunch.Pool.FreeList(ref obj2); return(true); } case ChatChannel.Global: if (Server.globalchat) { ConsoleNetwork.BroadcastToAllClients("chat.add2", 0, userId, text, text4, text3, 1f); return(true); } break; case ChatChannel.Team: { RelationshipManager.PlayerTeam playerTeam = RelationshipManager.ServerInstance.FindPlayersTeam(userId); if (playerTeam == null) { return(false); } List <Network.Connection> onlineMemberConnections = playerTeam.GetOnlineMemberConnections(); if (onlineMemberConnections != null) { ConsoleNetwork.SendClientCommand(onlineMemberConnections, "chat.add2", 1, userId, text, text4, text3, 1f); } Util.BroadcastTeamChat(playerTeam, userId, text4, text, text3); return(true); } } if (player != null) { float num2 = 2500f; foreach (BasePlayer activePlayer in BasePlayer.activePlayerList) { float sqrMagnitude = (activePlayer.transform.position - player.transform.position).sqrMagnitude; if (!(sqrMagnitude > num2)) { ConsoleNetwork.SendClientCommand(activePlayer.net.connection, "chat.add2", 0, userId, text, text4, text3, Mathf.Clamp01(num2 - sqrMagnitude + 0.2f)); } } return(true); } return(false); }
public void OnNewConnection(Connection connection) { connection.connected = (__Null)0; if (connection.token == null || connection.token.Length < 32) { ConnectionAuth.Reject(connection, "Invalid Token"); } else if (connection.userid == null) { ConnectionAuth.Reject(connection, "Invalid SteamID"); } else { if (connection.protocol != 2161) { if (DeveloperList.Contains((ulong)connection.userid)) { DebugEx.Log((object)("Not kicking " + (object)(ulong)connection.userid + " for incompatible protocol (is a developer)"), (StackTraceLogType)0); } else { ConnectionAuth.Reject(connection, "Incompatible Version"); return; } } if (ServerUsers.Is((ulong)connection.userid, ServerUsers.UserGroup.Banned)) { ConnectionAuth.Reject(connection, "You are banned from this server"); } else { if (ServerUsers.Is((ulong)connection.userid, ServerUsers.UserGroup.Moderator)) { DebugEx.Log((object)(((object)connection).ToString() + " has auth level 1"), (StackTraceLogType)0); connection.authLevel = (__Null)1; } if (ServerUsers.Is((ulong)connection.userid, ServerUsers.UserGroup.Owner)) { DebugEx.Log((object)(((object)connection).ToString() + " has auth level 2"), (StackTraceLogType)0); connection.authLevel = (__Null)2; } if (DeveloperList.Contains((ulong)connection.userid)) { DebugEx.Log((object)(((object)connection).ToString() + " is a developer"), (StackTraceLogType)0); connection.authLevel = (__Null)3; } if (this.IsConnected((ulong)connection.userid)) { ConnectionAuth.Reject(connection, "You are already connected!"); } else { if (Interface.CallHook("IOnUserApprove", (object)connection) != null) { return; } ConnectionAuth.m_AuthConnection.Add(connection); this.StartCoroutine(this.AuthorisationRoutine(connection)); } } } }
public static void On_Chat(ConsoleSystem.Arg arg) { if (arg.ArgsStr.StartsWith("\"/") && !arg.ArgsStr.StartsWith("\"/ ")) { On_Command(arg); return; } if (!ConVar.Chat.enabled) { arg.ReplyWith("Chat is disabled."); } else { if (arg.ArgsStr == "\"\"") { return; } BasePlayer basePlayer = arg.Player(); if (!basePlayer) { return; } ChatEvent pChat = new ChatEvent(Server.GetPlayer(basePlayer), arg); string str = arg.GetString(0, "text"); if (str.Length > 128) { str = str.Substring(0, 128); } if (str.Length <= 0) { return; } if (ConVar.Chat.serverlog) { ServerConsole.PrintColoured(new object[] { ConsoleColor.DarkYellow, basePlayer.displayName + ": ", ConsoleColor.DarkGreen, str }); ConVar.Server.Log("Log.Chat.txt", string.Format("{0}/{1}: {2}\r\n", basePlayer.userID, basePlayer.displayName, str)); Debug.Log(string.Format("[CHAT] {0}: {1}", basePlayer.displayName, str)); } string arg2 = "#5af"; if (basePlayer.IsAdmin()) { arg2 = "#af5"; } if (DeveloperList.IsDeveloper(basePlayer)) { arg2 = "#fa5"; } OnNext("On_Chat", pChat); string text2 = string.Format("<color={2}>{0}</color>: {1}", basePlayer.displayName.Replace('<', '[').Replace('>', ']'), pChat.FinalText, arg2); if (pChat.FinalText != "") { Logger.ChatLog(pChat.BroadcastName, pChat.OriginalText); arg.ReplyWith(pChat.Reply); if (ConVar.Server.globalchat) { ConsoleSystem.Broadcast("chat.add", basePlayer.userID, text2, 1); } else { float num = 2500; foreach (Connection current in Net.sv.connections) { if (current.player != null) { float sqrMagnitude = (current.player.transform.position - basePlayer.transform.position).sqrMagnitude; if (sqrMagnitude <= num) { ConsoleSystem.SendClientCommand(current, "chat.add", basePlayer.userID, text2, Mathf.Clamp01(num - sqrMagnitude + 0.2f)); } } } } } } }