Beispiel #1
0
        /**
         * Trimmed the text
         */
        private static void handleCommandText(String command, int type, BetterNetworkUser sender)
        {
            command = command.Remove(0, 1);

            String[]      commandParams = command.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            List <string> words         = commandParams.ToList <string>();
            string        cmdText       = words.First();

            words.RemoveAt(0);

            DateTime myDate       = DateTime.Now;
            string   myDateString = myDate.ToString("yyyy-MM-dd HH:mm:ss");

            LogCommand(myDateString + ": " + sender.name + ": " + command);

            if (!ExecuteCommand(sender, cmdText, words)) //Command was not executed
            {
                if (!usingHiddenChat)
                {
                    NetworkChat.sendAlert("");  //avoid looping in commands
                }
            }
        }
Beispiel #2
0
 public CommandArgs(string message, BetterNetworkUser sender, List <string> args)
 {
     CommandString = message;
     this.sender   = sender;
     Parameters    = args;
 }
Beispiel #3
0
        public static void resetChat()
        {
            String[] texts = new String[4];
            texts[0] = getNetworkChatFieldByNum(13);
            texts[1] = getNetworkChatFieldByNum(20);
            texts[2] = getNetworkChatFieldByNum(27);
            texts[3] = getNetworkChatFieldByNum(34);

            for (int i = 0; i < 4; i++)
            {
                if (texts[i].StartsWith("/"))
                {
                    texts[i] = "";
                }
            }

            NetworkPlayer[] players     = new NetworkPlayer[4];
            bool[]          isServerMsg = new bool[4];
            String[]        names       = new String[4];

            names[0] = getNetworkChatFieldByNum(10);
            names[1] = getNetworkChatFieldByNum(17);
            names[2] = getNetworkChatFieldByNum(24);
            names[3] = getNetworkChatFieldByNum(31);


            for (int i = 0; i < 4; i++)
            {
                BetterNetworkUser temp1 = UserList.getUserFromName(names[i]);
                NetworkPlayer     temp;
                if (temp1 == null)
                {
                    temp = Network.player;
                }
                else
                {
                    temp = temp1.networkPlayer;
                }

                if (temp != null)
                {
                    players[i] = temp;
                }
                else
                {
                    players[i] = Network.player;
                }

                if (names[i] != null)
                {
                    if (names[i].StartsWith("Server"))
                    {
                        isServerMsg[i] = true;
                    }
                }
            }


            if (!isServerMsg[3])
            {
                getNetworkChat().askChat(texts[3], 0, players[3]);
            }
            else
            {
                NetworkChat.sendAlert(texts[3]);
            }

            for (int i = 0; i < 4; i++)
            {
                if (!isServerMsg[3 - i])
                {
                    getNetworkChat().askChat(texts[3 - i], 0, players[3 - i]);
                }
                else
                {
                    NetworkChat.sendAlert(texts[3 - i]);
                }
            }
        }
Beispiel #4
0
 public static void issueCommand(string alias, BetterNetworkUser sender)
 {
     CommandHandlerMain.ExecuteCommand(sender, alias, null);
 }
Beispiel #5
0
 public static void issueCommand(string alias, BetterNetworkUser sender, List <string> parms)
 {
     CommandHandlerMain.ExecuteCommand(sender, alias, parms);
 }