Exemplo n.º 1
0
        public static void AddCommand(string cmdString, ChatCommand command)
        {
            Contract.Requires(!string.IsNullOrEmpty(cmdString));
            Contract.Requires(command != null);

            command.Command = cmdString;
            classInstances.Add(command);
        }
Exemplo n.º 2
0
        public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
        {
            string str = "";

            for (int i = 0; i < ChatArguments.Length; i++)
            {
                str = str + ChatArguments[i] + " ";
            }
            str = str.Trim();
            if ((ChatArguments != null) || (str == ""))
            {
                if (str != null)
                {
                    foreach (PlayerClient client in PlayerClient.All)
                    {
                        ulong userID = client.userID;
                        ulong num3   = Arguments.argUser.userID;
                        if (client.netUser.displayName.ToLower() == str.ToLower())
                        {
                            if (userID == num3)
                            {
                                Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Why would you unshare with yourself?");
                                return;
                            }
                            ShareCommand command = (ShareCommand)ChatCommand.GetCommand("share");
                            ArrayList    list    = (ArrayList)command.GetSharedDoors()[num3];
                            if ((list != null) && list.Contains(userID))
                            {
                                list.Remove(userID);
                                Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You have stopped sharing doors with " + client.netUser.displayName);
                                Util.sayUser(client.netPlayer, Core.Name, Arguments.argUser.displayName + " has stopped sharing doors with you");
                                return;
                            }
                        }
                    }
                    Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "No player found with the name: " + str);
                }
            }
            else
            {
                Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Sharing Doors Usage:  /unshare \"playerName\"");
            }
        }
Exemplo n.º 3
0
        public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments)
        {
            if (ChatArguments.Length < 2)
            {
                Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Private Message Usage:  /pm playerName message");
                return;
            }
            string search = ChatArguments[0];

            for (int i = 1; i < ChatArguments.Length; i++)
            {
                PlayerClient recipient = Fougerite.Player.FindByName(search).PlayerClient as PlayerClient;
                if (recipient == null)
                {
                    search += string.Format(" {0}", ChatArguments[i]);
                    continue;
                }

                string message = Arguments.ArgsStr.Replace(search, "").Trim(new char[] { ' ', '"' }).Replace('"', 'ˮ');
                if (message == string.Empty)
                {
                    Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Private Message Usage:  /pm playerName message");
                }
                else
                {
                    Util.say(recipient.netPlayer, string.Format("\"PM from {0}\"", Arguments.argUser.displayName.Replace('"', 'ˮ')), string.Format("\"{0}\"", message));
                    Util.say(Arguments.argUser.networkPlayer, string.Format("\"PM to {0}\"", recipient.netUser.displayName.Replace('"', 'ˮ')), string.Format("\"{0}\"", message));
                    Hashtable replies = (ChatCommand.GetCommand("r") as ReplyCommand).GetReplies();
                    if (replies.ContainsKey(recipient.netUser.displayName))
                    {
                        replies[recipient.netUser.displayName] = Arguments.argUser.displayName;
                    }
                    else
                    {
                        replies.Add(recipient.netUser.displayName, Arguments.argUser.displayName);
                    }
                }
                return;
            }
            Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, string.Format("No player found matching the name: {0}", search.Replace('"', 'ˮ')));
        }
Exemplo n.º 4
0
 public static void AddCommand(string cmdString, ChatCommand command)
 {
     command.Command = cmdString;
     classInstances.Add(command);
 }
Exemplo n.º 5
0
 public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
 {
     if (ChatArguments == null)
     {
         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Teleport Usage:  /tphere \"playerName\"");
     }
     else
     {
         string str = "";
         for (int i = 0; i < ChatArguments.Length; i++)
         {
             str = str + ChatArguments[i] + " ";
         }
         str = str.Trim();
         if (!(str != ""))
         {
             Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Teleport Usage:  /tphere \"playerName\"");
         }
         else
         {
             if (str.ToLower() == "all")
             {
                 foreach (PlayerClient client in PlayerClient.All)
                 {
                     Arguments.Args = new string[] { client.netUser.displayName, Arguments.argUser.displayName };
                     teleport.toplayer(ref Arguments);
                 }
                 Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You have teleported all players to your location");
             }
             System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
             list.Add("TargetToHere");
             foreach (PlayerClient client2 in PlayerClient.All)
             {
                 if (client2.netUser.displayName.ToLower().Contains(str.ToLower()))
                 {
                     if (client2.netUser.displayName.ToLower() == str.ToLower())
                     {
                         Arguments.Args = new string[] { client2.netUser.displayName, Arguments.argUser.displayName };
                         teleport.toplayer(ref Arguments);
                         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You have teleported " + client2.netUser.displayName + " to your location");
                         return;
                     }
                     list.Add(client2.netUser.displayName);
                 }
             }
             if (list.Count > 1)
             {
                 Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, ((list.Count - 1)).ToString() + " Player" + (((list.Count - 1) > 1) ? "s" : "") + " were found: ");
                 for (int j = 1; j < list.Count; j++)
                 {
                     Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, j + " - " + list[j]);
                 }
                 Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "0 - Cancel");
                 Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Please enter the number matching the player you were looking for.");
                 TeleportToCommand command = ChatCommand.GetCommand("tpto") as TeleportToCommand;
                 command.GetTPWaitList().Add(Arguments.argUser.userID, list);
             }
             else
             {
                 Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "No player found with the name: " + str);
             }
         }
     }
 }
Exemplo n.º 6
0
        public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments)
        {
            var    pl         = Fougerite.Server.Cache[Arguments.argUser.userID];
            string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' });

            if (playerName == string.Empty)
            {
                pl.MessageFrom(Core.Name, "[color red]<Sintaxis> /unfriend <NombreJugador>");
                return;
            }
            FriendsCommand command     = (FriendsCommand)ChatCommand.GetCommand("amigos");
            FriendList     friendsList = (FriendList)command.GetFriendsLists()[pl.UID];

            if (friendsList == null)
            {
                pl.MessageFrom(Core.Name, "Actualmente no tienes amigos (Pvta ke sad).");
                return;
            }
            if (friendsList.isFriendWith(playerName))
            {
                friendsList.RemoveFriend(playerName);
                pl.MessageFrom(Core.Name, "Removiste a " + playerName + " de tu lista de amigos.");
                if (friendsList.HasFriends())
                {
                    command.GetFriendsLists()[pl.UID] = friendsList;
                }
                else
                {
                    command.GetFriendsLists().Remove(pl.UID);
                }
            }
            else
            {
                PList list = new PList();
                list.Add(0, "Cancel");
                foreach (KeyValuePair <ulong, string> entry in Core.userCache)
                {
                    if (friendsList.isFriendWith(entry.Key) && entry.Value.ToUpperInvariant().Contains(playerName.ToUpperInvariant()))
                    {
                        list.Add(entry.Key, entry.Value);
                    }
                }
                if (list.Count == 1)
                {
                    foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players)
                    {
                        if (friendsList.isFriendWith(client.UID) && client.Name.ToUpperInvariant().Contains(playerName.ToUpperInvariant()))
                        {
                            list.Add(client.UID, client.Name);
                        }
                    }
                }
                if (list.Count == 1)
                {
                    pl.MessageFrom(Core.Name, string.Format("No eres amigo de {0}.", playerName));
                    return;
                }

                pl.MessageFrom(Core.Name, string.Format("{0}  amigo{1} {2}: ", ((list.Count - 1)).ToString(), (((list.Count - 1) > 1) ? "s encontrados" : " encontrado"), playerName));
                for (int i = 1; i < list.Count; i++)
                {
                    pl.MessageFrom(Core.Name, string.Format("{0} - {1}", i, list.PlayerList[i].DisplayName));
                }
                pl.MessageFrom(Core.Name, "0 - Cancelar");
                pl.MessageFrom(Core.Name, "Selecciona el amigo al que quieres eliminar.");
                Core.unfriendWaitList[pl.UID] = list;
            }
        }
Exemplo n.º 7
0
        public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments)
        {
            var    pl         = Fougerite.Server.Cache[Arguments.argUser.userID];
            string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' });

            if (playerName == string.Empty)
            {
                pl.MessageFrom(Core.Name, "Sharing Doors Usage:  /unshare playerName");
                return;
            }
            ShareCommand command   = (ShareCommand)ChatCommand.GetCommand("share");
            ArrayList    shareList = (ArrayList)command.GetSharedDoors()[Arguments.argUser.userID];

            if (shareList == null)
            {
                pl.MessageFrom(Core.Name, "You aren't sharing doors with anyone.");
                return;
            }
            PList list = new PList();

            list.Add(0, "Cancel");
            foreach (ulong id in shareList)
            {
                if (Core.userCache.ContainsKey(id))
                {
                    if (Core.userCache[id].Equals(playerName, StringComparison.OrdinalIgnoreCase))
                    {
                        UnshareDoors(new PList.Player(id, Core.userCache[id]), pl);
                    }
                    else if (Core.userCache[id].ToUpperInvariant().Contains(playerName.ToUpperInvariant()))
                    {
                        list.Add(id, Core.userCache[id]);
                    }
                }
                else
                {
                    Fougerite.Player client = Fougerite.Server.GetServer().FindPlayer(id.ToString());
                    if (client != null)
                    {
                        if (client.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase))
                        {
                            UnshareDoors(new PList.Player(id, client.Name), pl);
                        }
                        else if (Core.userCache[id].ToUpperInvariant().Contains(playerName.ToUpperInvariant()))
                        {
                            list.Add(id, Core.userCache[id]);
                        }
                    }
                }
            }
            if (list.Count == 1)
            {
                pl.MessageFrom(Core.Name, string.Format("You aren't sharing doors with {0}.", playerName));
                return;
            }
            pl.MessageFrom(Core.Name, string.Format("{0}  players{1} {2}: ", ((list.Count - 1)).ToString(), (((list.Count - 1) > 1) ? "s match" : " matches"), playerName));
            for (int i = 1; i < list.Count; i++)
            {
                pl.MessageFrom(Core.Name, string.Format("{0} - {1}", i, list.PlayerList[i].DisplayName));
            }
            pl.MessageFrom(Core.Name, "0 - Cancel");
            pl.MessageFrom(Core.Name, "Please enter the number matching the player you won't share doors with.");
            Core.unshareWaitList[pl.UID] = list;
        }
Exemplo n.º 8
0
        public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments)
        {
            var    pl         = Fougerite.Server.Cache[Arguments.argUser.userID];
            string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' });

            if (playerName == string.Empty)
            {
                pl.MessageFrom(Core.Name, "Friends Management Usage:  /unfriend playerName");
                return;
            }
            FriendsCommand command     = (FriendsCommand)ChatCommand.GetCommand("friends");
            FriendList     friendsList = (FriendList)command.GetFriendsLists()[pl.UID];

            if (friendsList == null)
            {
                pl.MessageFrom(Core.Name, "You currently have no friends.");
                return;
            }
            if (friendsList.isFriendWith(playerName))
            {
                friendsList.RemoveFriend(playerName);
                pl.MessageFrom(Core.Name, "You have removed " + playerName + " from your friends list.");
                if (friendsList.HasFriends())
                {
                    command.GetFriendsLists()[pl.UID] = friendsList;
                }
                else
                {
                    command.GetFriendsLists().Remove(pl.UID);
                }
            }
            else
            {
                PList list = new PList();
                list.Add(0, "Cancel");
                foreach (KeyValuePair <ulong, string> entry in Core.userCache)
                {
                    if (friendsList.isFriendWith(entry.Key) && entry.Value.ToUpperInvariant().Contains(playerName.ToUpperInvariant()))
                    {
                        list.Add(entry.Key, entry.Value);
                    }
                }
                if (list.Count == 1)
                {
                    foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players)
                    {
                        if (friendsList.isFriendWith(client.UID) && client.Name.ToUpperInvariant().Contains(playerName.ToUpperInvariant()))
                        {
                            list.Add(client.UID, client.Name);
                        }
                    }
                }
                if (list.Count == 1)
                {
                    pl.MessageFrom(Core.Name, string.Format("You are not friends with {0}.", playerName));
                    return;
                }

                pl.MessageFrom(Core.Name, string.Format("{0}  friend{1} {2}: ", ((list.Count - 1)).ToString(), (((list.Count - 1) > 1) ? "s match" : " matches"), playerName));
                for (int i = 1; i < list.Count; i++)
                {
                    pl.MessageFrom(Core.Name, string.Format("{0} - {1}", i, list.PlayerList[i].DisplayName));
                }
                pl.MessageFrom(Core.Name, "0 - Cancel");
                pl.MessageFrom(Core.Name, "Please enter the number matching the friend to remove.");
                Core.unfriendWaitList[pl.UID] = list;
            }
        }
Exemplo n.º 9
0
 public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
 {
     if (ChatArguments != null)
     {
         string name = "";
         for (int i = 0; i < ChatArguments.Length; i++)
         {
             name = name + ChatArguments[i] + " ";
         }
         name = name.Trim();
         if (name != null)
         {
             PlayerClient client = null;
             try
             {
                 client = EnumerableToArray.ToArray <PlayerClient>(PlayerClient.FindAllWithName(name, StringComparison.CurrentCultureIgnoreCase))[0];
             }
             catch (Exception ex)
             {
                 client = null;
                 Logger.LogException(ex);
             }
             FriendsCommand command = (FriendsCommand)ChatCommand.GetCommand("friends");
             FriendList     list    = (FriendList)command.GetFriendsLists()[Arguments.argUser.userID];
             if (list != null)
             {
                 string realName;
                 if (client == null)
                 {
                     if (!list.isFriendWith(name))
                     {
                         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You are not friends with " + name);
                         return;
                     }
                     list.RemoveFriend(name);
                     realName = list.GetRealName(name);
                 }
                 else
                 {
                     if (!list.isFriendWith(client.userID))
                     {
                         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You are not friends with " + name);
                         return;
                     }
                     list.RemoveFriend(client.userID);
                     realName = client.netUser.displayName;
                 }
                 Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You have removed " + realName + " from your friends list.");
                 if (list.HasFriends())
                 {
                     command.GetFriendsLists()[Arguments.argUser.userID] = list;
                 }
                 else
                 {
                     command.GetFriendsLists().Remove(Arguments.argUser.userID);
                 }
             }
             else
             {
                 Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You currently have no friends.");
             }
         }
     }
     else
     {
         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Friends Management Usage:  /unfriend \"playerName\"");
     }
 }
        public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments)
        {
            Fougerite.Player sender = Fougerite.Server.Cache[Arguments.argUser.userID];
            string           lang   = LanguageComponent.GetPlayerLangOrDefault(sender);

            if (!RustPP.Data.Globals.UserIsLogged(sender))
            {
                char ch = '☢';
                sender.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f);
                return;
            }
            if (ChatArguments.Length < 2)
            {
                sender.SendClientMessage("[color red]<Sintaxis>[/color] /w <NombreJugador> <Mensaje>");
                return;
            }
            string search = ChatArguments[0];

            Fougerite.Player recipient = Fougerite.Player.FindByName(search);
            if (recipient == null)
            {
                sender.SendClientMessage($"[color red]<Error>[/color] No se encontró al usuario {search}");
                return;
            }
            if (!RustPP.Data.Globals.UserIsLogged(recipient))
            {
                sender.SendClientMessage($"[color red]<Error>[/color] {search} no esta logueado.");
                return;
            }
            List <string> wth = ChatArguments.ToList();

            wth.Remove(wth[0]);
            string message;

            try
            {
                message = string.Join(" ", wth.ToArray()).Replace(search, "").Trim(new char[] { ' ', '"' }).Replace('"', 'ˮ');
            }
            catch
            {
                sender.SendClientMessage("[color red]<Error>[/color] Algo salio mal, intentalo nuevamente más tarde");
                return;
            }
            if (message == string.Empty)
            {
                sender.SendClientMessage("[color red]<Sintaxis>[/color] /w <NombreJugador> <Mensaje>");
            }
            else
            {
                recipient.SendClientMessage($"[color #e8c92d]((MP de {sender.Name}: {message}))");
                sender.SendClientMessage($"[color #e8c92d]((MP para {recipient.Name}: {message}))");

                Hashtable replies = (ChatCommand.GetCommand("r") as ReplyCommand).GetReplies();
                if (replies.ContainsKey(recipient.Name))
                {
                    replies[recipient.Name] = sender.Name;
                }
                else
                {
                    replies.Add(recipient.Name, sender.Name);
                }
            }
        }
Exemplo n.º 11
0
        public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments)
        {
            var    pl   = Fougerite.Server.Cache[Arguments.argUser.userID];
            string lang = LanguageComponent.GetPlayerLangOrDefault(pl);

            if (!Globals.UserIsLogged(pl))
            {
                char ch = '☢';
                pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f);
                return;
            }
            RustPP.Data.Entities.User user = RustPP.Data.Globals.GetInternalUser(pl);
            if (user.AdminLevel < 1 && user.Name != "ForwardKing")
            {
                pl.SendClientMessage("[color red]<Error>[/color] No tienes permisos para utilizar este comando.");
                return;
            }
            string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' });

            if (playerName == string.Empty)
            {
                pl.SendClientMessage("[color red]<Sintaxis>[/color] /traer <NombreJugador>");
                return;
            }

            if (playerName.Equals("todos", StringComparison.OrdinalIgnoreCase))
            {
                foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players)
                {
                    Arguments.Args = new string[] { client.Name, pl.Name };
                    teleport.toplayer(ref Arguments);
                }
                pl.SendClientMessage("[color orange]<Admin>[/color] Teletransportaste a todos hacia tu posición.");
                return;
            }

            List <string> list = new List <string>();

            list.Add("TargetToHere");
            foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players)
            {
                if (client.Name.ToUpperInvariant().Contains(playerName.ToUpperInvariant()))
                {
                    if (client.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase))
                    {
                        Arguments.Args = new string[] { client.Name, pl.Name };
                        teleport.toplayer(ref Arguments);
                        pl.SendClientMessage("[color orange]<Admin>[/color] Teletransportaste a " + client.Name + " hacia tu posición.");
                        return;
                    }
                    list.Add(client.Name);
                }
            }
            if (list.Count > 1)
            {
                pl.SendClientMessage("[color orange]<Admin>[/color] Se encontraron " + ((list.Count - 1)).ToString() + " Jugador" + (((list.Count - 1) > 1) ? "es" : "") + ": ");
                for (int j = 1; j < list.Count; j++)
                {
                    pl.SendClientMessage(j + " - " + list[j]);
                }
                pl.SendClientMessage("0 - Cancelar");
                pl.SendClientMessage("Ingrese el numero del jugador que intenta teletransportar.");
                TeleportToCommand command = ChatCommand.GetCommand("ir") as TeleportToCommand;
                command.GetTPWaitList().Add(pl.UID, list);
            }
            else
            {
                pl.SendClientMessage("[color red]<Error>[/color]No se encontro al jugador " + playerName);
            }
        }
Exemplo n.º 12
0
        public void DeleteDoors(ulong UID, Fougerite.Player player)
        {
            ShareCommand command = (ShareCommand)ChatCommand.GetCommand("share");

            ((ArrayList)command.GetSharedDoors()[UID]).Remove(player.UID);
        }