Пример #1
0
        private void cmdChatDroplimit(BasePlayer player, string command, string[] args)
        {
            var usage = _("Usage: /droplimit \"ITEMNAME\" [LIMIT]");

            if (!initialized)
            {
                return;
            }
            if (!ServerUsers.Is(player.userID, ServerUsers.UserGroup.Owner))
            {
                SendReply(player, _("You are not authorized to modify drop limits"));
                return;
            }
            if (args.Length < 1)
            {
                SendReply(player, usage);
                return;
            }
            string name = args[0];
            int    currentLimit;

            if (!dropLimits.TryGetValue(name, out currentLimit))
            {
                SendReply(player, _("No such item:") + " " + name);
                return;
            }
            if (args.Length == 1)
            {
                SendReply(player, _("Drop limit of '%NAME%' is %LIMIT%", new Dictionary <string, string>()
                {
                    { "ITEM", name },
                    { "LIMIT", currentLimit.ToString() }
                }));
                return;
            }
            int limit = Convert.ToInt32(args[1]);

            dropLimits[name] = limit;
            SaveConfig();
            SendReply(player, "Drop limit of '%NAME%' has been changed from %LIMIT% to %NEWLIMIT%", new Dictionary <string, string>()
            {
                { "NAME", name },
                { "LIMIT", currentLimit.ToString() },
                { "NEWLIMIT", limit.ToString() }
            });
        }
Пример #2
0
    public static bool ValidateConnecting(
        ulong steamid,
        ulong ownerSteamID,
        ServerAuth.Status response)
    {
        Connection connection = Auth_Steam.waitingList.Find((Predicate <Connection>)(x => x.userid == (long)steamid));

        if (connection == null)
        {
            return(false);
        }
        connection.ownerid = (__Null)(long)ownerSteamID;
        if (ServerUsers.Is(ownerSteamID, ServerUsers.UserGroup.Banned) || ServerUsers.Is(steamid, ServerUsers.UserGroup.Banned))
        {
            connection.authStatus = (__Null)"banned";
            return(true);
        }
        if (response == null)
        {
            connection.authStatus = (__Null)"ok";
            return(true);
        }
        if (response == 3)
        {
            connection.authStatus = (__Null)"vacbanned";
            return(true);
        }
        if (response == 9)
        {
            connection.authStatus = (__Null)"gamebanned";
            return(true);
        }
        if (response == 5)
        {
            connection.authStatus = (__Null)"ok";
            return(true);
        }
        connection.authStatus = (__Null)response.ToString();
        return(true);
    }
Пример #3
0
    public static bool ValidateConnecting(SteamId steamid, SteamId ownerSteamID, AuthResponse response)
    {
        Connection str = Auth_Steam.waitingList.Find((Connection x) => x.userid == steamid);

        if (str == null)
        {
            return(false);
        }
        str.ownerid = ownerSteamID;
        if (ServerUsers.Is(ownerSteamID, ServerUsers.UserGroup.Banned) || ServerUsers.Is(steamid, ServerUsers.UserGroup.Banned))
        {
            str.authStatus = "banned";
            return(true);
        }
        if (response == AuthResponse.OK)
        {
            str.authStatus = "ok";
            return(true);
        }
        if (response == AuthResponse.VACBanned)
        {
            str.authStatus = "vacbanned";
            return(true);
        }
        if (response == AuthResponse.PublisherIssuedBan)
        {
            str.authStatus = "gamebanned";
            return(true);
        }
        if (response == AuthResponse.VACCheckTimedOut)
        {
            str.authStatus = "ok";
            return(true);
        }
        str.authStatus = response.ToString();
        return(true);
    }
Пример #4
0
    public static bool ValidateConnecting(ulong steamid, ulong ownerSteamID, AuthResponse response)
    {
        Connection connection = waitingList.Find((Connection x) => x.userid == steamid);

        if (connection == null)
        {
            return(false);
        }
        connection.ownerid = ownerSteamID;
        if (ServerUsers.Is(ownerSteamID, ServerUsers.UserGroup.Banned) || ServerUsers.Is(steamid, ServerUsers.UserGroup.Banned))
        {
            connection.authStatus = "banned";
            return(true);
        }
        switch (response)
        {
        case AuthResponse.OK:
            connection.authStatus = "ok";
            return(true);

        case AuthResponse.VACBanned:
            connection.authStatus = "vacbanned";
            return(true);

        case AuthResponse.PublisherBanned:
            connection.authStatus = "gamebanned";
            return(true);

        case AuthResponse.TimedOut:
            connection.authStatus = "ok";
            return(true);

        default:
            connection.authStatus = response.ToString();
            return(true);
        }
    }
 bool IsOwner(string steamId) => ServerUsers.Is(Convert.ToUInt64(steamId), ServerUsers.UserGroup.Owner);
 bool IsMod(string steamId) => ServerUsers.Is(Convert.ToUInt64(steamId), ServerUsers.UserGroup.Moderator);
Пример #7
0
 /// <summary>
 /// Gets if the player is banned
 /// </summary>
 /// <param name="id"></param>
 public bool IsBanned(string id) => ServerUsers.Is(ulong.Parse(id), ServerUsers.UserGroup.Banned);
Пример #8
0
 public bool IsBanned(string id)
 {
     return(ServerUsers.Is(UInt64.Parse(id), ServerUsers.UserGroup.Banned));
 }
Пример #9
0
 public bool IsBanned(ulong id)
 {
     return(ServerUsers.Is(id, ServerUsers.UserGroup.Banned));
 }
Пример #10
0
 /// <summary>
 /// Gets if the player is banned
 /// </summary>
 public bool IsBanned(string id) => ServerUsers.Is(Convert.ToUInt64(id), ServerUsers.UserGroup.Banned);
Пример #11
0
        bool CanLootPlayer(BasePlayer target, BasePlayer looter)
        {
            //Check if we have Friends plugin and then if admin or mod
            if (Friends == null || (ServerUsers.Is(looter.userID, ServerUsers.UserGroup.Owner) || ServerUsers.Is(looter.userID, ServerUsers.UserGroup.Moderator)))
            {
                return(true);
            }

            return((bool)Friends.Call("HasFriend", target.userID, looter.userID));
        }
Пример #12
0
 private void OnItemAddedToContainer(ItemContainer container, Item item)
 {
     if (!initialized || !enforceBlacklist)
     {
         return;
     }
     try {
         var owner = item.GetOwnerPlayer();
         if (owner != null && (ServerUsers.Is(owner.userID, ServerUsers.UserGroup.Owner) || ServerUsers.Is(owner.userID, ServerUsers.UserGroup.Moderator)))
         {
             return;
         }
         if (!item.isBlueprint && itemBlacklist.Contains(item.info.shortname))
         {
             Log(string.Format("Destroying item instance of '{0}'", item.info.shortname));
             item.RemoveFromContainer();
             item.Remove(0f);
         }
         else if (item.isBlueprint && blueprintBlacklist.Contains(item.info.shortname))
         {
             Log(string.Format("Destroying blueprint instance of '{0}'", item.info.shortname));
             item.RemoveFromContainer();
             item.Remove(0f);
         }
     } catch (Exception ex) {
         Error("OnItemAddedToContainer failed: " + ex.Message);
     }
 }
Пример #13
0
        private void cmdChatBlacklist(BasePlayer player, string command, string[] args)
        {
            var usage = _("Usage: /blacklist [additem|deleteitem|addbp|deletebp] \"ITEMNAME\"");

            if (!initialized)
            {
                return;
            }
            if (args.Length == 0)
            {
                if (itemBlacklist.Count == 0)
                {
                    SendReply(player, _("There are no blacklisted items"));
                }
                else
                {
                    var sb = new StringBuilder();
                    foreach (var item in itemBlacklist)
                    {
                        if (sb.Length > 0)
                        {
                            sb.Append(", ");
                        }
                        sb.Append(item);
                    }
                    SendReply(player, _("Blacklisted items:") + " " + sb.ToString());
                }
                if (blueprintBlacklist.Count == 0)
                {
                    SendReply(player, _("There are no blacklisted blueprints"));
                }
                else
                {
                    var sb = new StringBuilder();
                    foreach (var item in blueprintBlacklist)
                    {
                        if (sb.Length > 0)
                        {
                            sb.Append(", ");
                        }
                        sb.Append(item);
                    }
                    SendReply(player, _("Blacklisted blueprints:") + " " + sb.ToString());
                }
                return;
            }
            if (!ServerUsers.Is(player.userID, ServerUsers.UserGroup.Owner))
            {
                SendReply(player, _("You are not authorized to modify the blacklist"));
                return;
            }
            if (args.Length != 2)
            {
                SendReply(player, usage);
                return;
            }
            if (args[0] == "additem")
            {
                if (!ItemExists(args[1]))
                {
                    SendReply(player, _("Not a valid item:") + " " + args[1]);
                    return;
                }
                if (!itemBlacklist.Contains(args[1]))
                {
                    itemBlacklist.Add(args[1]);
                    UpdateInternals(false);
                    SendReply(player, _("The item '%NAME%' is now blacklisted", new Dictionary <string, string>()
                    {
                        { "NAME", args[1] }
                    }));
                    SaveConfig();
                    return;
                }
                else
                {
                    SendReply(player, _("The item '%NAME%' is already blacklisted", new Dictionary <string, string>()
                    {
                        { "NAME", args[1] }
                    }));
                    return;
                }
            }
            else if (args[0] == "addbp")
            {
                if (!BlueprintExists(args[1]))
                {
                    SendReply(player, _("Not a valid blueprint:") + " " + args[1]);
                    return;
                }
                if (!blueprintBlacklist.Contains(args[1]))
                {
                    blueprintBlacklist.Add(args[1]);
                    UpdateInternals(false);
                    SendReply(player, _("The blueprint '%NAME%' is now blacklisted", new Dictionary <string, string>()
                    {
                        { "NAME", args[1] }
                    }));
                    SaveConfig();
                    return;
                }
                else
                {
                    SendReply(player, _("The blueprint '%NAME%' is already blacklisted", new Dictionary <string, string>()
                    {
                        { "NAME", args[1] }
                    }));
                    return;
                }
            }
            else if (args[0] == "deleteitem")
            {
                if (!ItemExists(args[1]))
                {
                    SendReply(player, _("Not a valid item:") + " " + args[1]);
                    return;
                }
                if (itemBlacklist.Contains(args[1]))
                {
                    itemBlacklist.Remove(args[1]);
                    UpdateInternals(false);
                    SendReply(player, _("The item '%NAME%' is now no longer blacklisted", new Dictionary <string, string>()
                    {
                        { "NAME", args[1] }
                    }));
                    SaveConfig();
                    return;
                }
                else
                {
                    SendReply(player, _("The item '%NAME%' is not blacklisted", new Dictionary <string, string>()
                    {
                        { "NAME", args[1] }
                    }));
                    return;
                }
            }
            else if (args[0] == "deletebp")
            {
                if (!BlueprintExists(args[1]))
                {
                    SendReply(player, _("Not a valid blueprint:") + " " + args[1]);
                    return;
                }
                if (blueprintBlacklist.Contains(args[1]))
                {
                    blueprintBlacklist.Remove(args[1]);
                    UpdateInternals(false);
                    SendReply(player, _("The blueprint '%NAME%' is now no longer blacklisted", new Dictionary <string, string>()
                    {
                        { "NAME", args[1] }
                    }));
                    SaveConfig();
                    return;
                }
                else
                {
                    SendReply(player, _("The blueprint '%NAME' is not blacklisted", new Dictionary <string, string>()
                    {
                        { "NAME", args[1] }
                    }));
                    return;
                }
            }
            else
            {
                SendReply(player, usage);
                return;
            }
        }
Пример #14
0
 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));
             }
         }
     }
 }
Пример #15
0
 /// <summary>
 /// Returns if the player is admin
 /// </summary>
 public bool IsAdmin(string id) => ServerUsers.Is(Convert.ToUInt64(id), ServerUsers.UserGroup.Owner);
Пример #16
0
 /// <summary>
 /// Returns if the player is admin
 /// </summary>
 public bool IsAdmin(ulong id) => ServerUsers.Is(id, ServerUsers.UserGroup.Owner);
Пример #17
0
        void cmdChatBlacklist(BasePlayer player, string command, string[] args)
        {
            string usage = "Usage: /blacklist [additem|deleteitem] \"ITEMNAME\"";

            if (!initialized)
            {
                SendReply(player, string.Format("Plugin not enabled."));
                return;
            }
            if (args.Length == 0)
            {
                if (storedBlacklist.ItemList.Count == 0)
                {
                    SendReply(player, string.Format("There are no blacklisted items"));
                }
                else
                {
                    var sb = new StringBuilder();
                    foreach (var item in storedBlacklist.ItemList)
                    {
                        if (sb.Length > 0)
                        {
                            sb.Append(", ");
                        }
                        sb.Append(item);
                    }
                    SendReply(player, string.Format("Blacklisted items: {0}", sb.ToString()));
                }
                return;
            }
            if (!ServerUsers.Is(player.userID, ServerUsers.UserGroup.Owner))
            {
                //SendReply(player, string.Format(lang.GetMessage("msgNotAuthorized", this, player.UserIDString)));
                SendReply(player, "You are not authorized to use this command");
                return;
            }
            if (args.Length != 2)
            {
                SendReply(player, usage);
                return;
            }
            if (args[0] == "additem")
            {
                if (!ItemExists(args[1]))
                {
                    SendReply(player, string.Format("Not a valid item: {0}", args[1]));
                    return;
                }
                if (!storedBlacklist.ItemList.Contains(args[1]))
                {
                    storedBlacklist.ItemList.Add(args[1]);
                    UpdateInternals(false);
                    SendReply(player, string.Format("The item '{0}' is now blacklisted", args[1]));
                    SaveBlacklist();
                    return;
                }
                else
                {
                    SendReply(player, string.Format("The item '{0}' is already blacklisted", args[1]));
                    return;
                }
            }
            else if (args[0] == "deleteitem")
            {
                if (!ItemExists(args[1]))
                {
                    SendReply(player, string.Format("Not a valid item: {0}", args[1]));
                    return;
                }
                if (storedBlacklist.ItemList.Contains(args[1]))
                {
                    storedBlacklist.ItemList.Remove(args[1]);
                    UpdateInternals(false);
                    SendReply(player, string.Format("The item '{0}' is now no longer blacklisted", args[1]));
                    SaveBlacklist();
                    return;
                }
                else
                {
                    SendReply(player, string.Format("The item '{0}' is not blacklisted", args[1]));
                    return;
                }
            }
            else
            {
                SendReply(player, usage);
                return;
            }
        }
Пример #18
0
 /// <summary>
 /// Gets if the player is banned
 /// </summary>
 public bool IsBanned(ulong id) => ServerUsers.Is(id, ServerUsers.UserGroup.Banned);
Пример #19
0
 public bool IsAdmin(ulong id)
 {
     return(ServerUsers.Is(id, ServerUsers.UserGroup.Owner));
 }