Example #1
0
        public static void SetGlobalLoginCommands(string text, int waitTimeMs)
        {
            var persister = new LoginCommandPersister();
            var cmds      = ParseCommandsFromText(text);

            persister.WriteQueue(cmds, global: true);
        }
Example #2
0
        public static void SetLoginCommands(string accountName, string serverName, string characterName, string text, int waitTimeMs)
        {
            var persister = new LoginCommandPersister(accountName: accountName, serverName: serverName, characterName: characterName);
            var cmds      = ParseCommandsFromText(text);

            persister.WriteQueue(cmds, global: false);
        }
        public void FilterCore_CommandLineText(object sender, ChatParserInterceptEventArgs e)
        {
            bool   writeChanges = true;
            bool   global       = false;
            string cmdtext      = e.Text;

            if (cmdtext.Contains("/mfglobal"))
            {
                cmdtext = cmdtext.Replace(" /mfglobal", " /mf");
                cmdtext = cmdtext.Replace("/mfglobal ", "/mf ");
                cmdtext = cmdtext.Replace("/mfglobal", "/mf");
                global  = true;
            }
            if (cmdtext.StartsWith("/mf log "))
            {
                string logmsg = TextRemainder(cmdtext, "/mf log ");
                log.WriteInfo(logmsg);

                e.Eat = true;
            }
            else if (cmdtext.StartsWith("/mf alcmq add ") || cmdtext.StartsWith("/mf olcmq add "))
            {
                string cmd = TextRemainder(cmdtext, "/mf alcmq add ");
                _loginCmds.Commands.Enqueue(cmd);
                Debug.WriteToChat("After Login Complete Message Queue added: " + cmd);

                e.Eat = true;
            }
            else if (cmdtext == "/mf alcmq clear" || cmdtext == "/mf olcmq clear")
            {
                _loginCmds.Commands.Clear();
                Debug.WriteToChat("After Login Complete Message Queue cleared");

                e.Eat = true;
            }
            else if (cmdtext.StartsWith("/mf alcmq wait set "))
            {
                string valstr = TextRemainder(cmdtext, "/mf alcmq wait set ");
                _loginCmds.WaitMillisencds = int.Parse(valstr);
                Debug.WriteToChat("After Login Complete Message Queue Wait time set: " + valstr + "ms");

                e.Eat = true;
            }
            else if (cmdtext.StartsWith("/mf olcwait set ")) // Backwards Compatability
            {
                string valstr = TextRemainder(cmdtext, "/mf olcwait set ");
                _loginCmds.WaitMillisencds = int.Parse(valstr);
                Debug.WriteToChat("After Login Complete Message Queue Wait time set: " + valstr + "ms");

                e.Eat = true;
            }
            else if (cmdtext == "/mf alcmq wait clear" || cmdtext == "/mf olcwait clear")
            {
                _loginCmds.ClearWait();
                Debug.WriteToChat(string.Format("After Login Complete Wait time reset to default {0} ms", LoginCommands.DefaultMillisecondsToWaitAfterLoginComplete));

                e.Eat = true;
            }
            else if (cmdtext == "/mf alcmq show" || cmdtext == "/mf olcmq show" || cmdtext == "/mf alcmq list" || cmdtext == "/mf olcmq list")
            {
                var rdr   = new LoginCommandPersister(GameRepo.Game.Account, GameRepo.Game.Server, GameRepo.Game.Character);
                var queue = rdr.ReadQueue(global);
                Debug.WriteToChat(string.Format("LoginCmds: {0}", queue.Commands.Count));
                foreach (string cmd in queue.Commands)
                {
                    Debug.WriteToChat(string.Format("cmd: {0}", cmd));
                }
                Debug.WriteToChat(string.Format("Wait: {0}", queue.WaitMillisencds));
                e.Eat        = true;
                writeChanges = false;
            }
            if (e.Eat && writeChanges)
            {
                var persister = new LoginCommandPersister(GameRepo.Game.Account, GameRepo.Game.Server, GameRepo.Game.Character);
                persister.WriteQueue(_loginCmds, global);
            }
        }