Exemplo n.º 1
0
        /// <summary>
        /// Pure chat completion
        /// </summary>
        public static void ParseClientChat(Client player, TabCompleteClient tab)
        {
            if (tab.Command.StartsWith("."))
            {
                Client p = PlayerList.GetPlayerByName(tab.Command.Substring(1));
                if (p != null)
                {
                    player.SendToClient(TabComplete.Single("." + p.Name + " "));
                }
                return;
            }

            string last = tab.Command;

            if (last.StartsWith("co"))
            {
                player.SendToClient(TabComplete.Single(last + " " + player.Session.Position.ToString("0")));
                return;
            }

            {
                Client p = PlayerList.GetPlayerByName(last);
                if (p != null)
                {
                    player.Queue.Queue(TabComplete.Single(p.Name));
                    return;
                }
            }

            player.SendToClient(TabComplete.Single(last + " /love " + player.Name + " "));
        }
Exemplo n.º 2
0
 public static void ParseClient(Client player, TabCompleteClient tab)
 {
     if (tab.Command.StartsWith("/"))
     {
         MainCommands.ParseClientTab(player, tab);
     }
     else
     {
         ParseClientChat(player, tab);
     }
 }
Exemplo n.º 3
0
        public static void ParseClientTab(Client player, TabCompleteClient tab)
        {
            string[] cmd = tab.Command.Substring(1).Replace("  ", " ").Split(' ');
            cmd [0] = cmd [0].Trim().Trim('/');

            var tc = new TabComplete();

            var commander = player.Session.World.Commands;

            if (commander != null)
            {
                player.Session.World.Commands.ParseTab(player, cmd, 1, tc);
                if (tc.Alternatives.Count > 0)
                {
                    player.Queue.Queue(tc);
                    return;
                }
            }

            Instance.ParseTab(player, cmd, 1, tc);
            if (tc.Alternatives.Count > 0)
            {
                player.Queue.Queue(tc);
                return;
            }

            if (cmd.Length > 1)
            {
                Client p;
                if (player.Admin(Permissions.AnyAdmin))
                {
                    p = PlayerList.GetPlayerByUsernameOrName(cmd [cmd.Length - 1]);
                }
                else
                {
                    p = PlayerList.GetPlayerByName(cmd [cmd.Length - 1]);
                }
                if (p != null)
                {
                    player.Queue.Queue(TabComplete.Single(p.Name));
                }
            }
        }