public void Invoke(DonationEventArgs e)
        {
            while (Runing)
            {
                Thread.Sleep(100);
            }
            Runing = true;
            string scripd = Script;

            if (scripd.Contains("%"))
            {
                if (scripd.Contains("%TEXT%"))
                {
                    scripd = scripd.Replace("%TEXT%", e.Message.Replace("\n", "").Trim());
                }
                if (scripd.Contains("%NICK%"))
                {
                    scripd = scripd.Replace("%NICK%", e.NickName.Replace("\n", "").Trim());
                }
                if (scripd.Contains("%AMOUNT%"))
                {
                    scripd = scripd.Replace("%AMOUNT%", e.Amount.ToString());
                }
                if (scripd.Contains("%CURRENCY%"))
                {
                    scripd = scripd.Replace("%CURRENCY%", e.Currency.Replace("\n", "").Trim());
                }
            }
            ScriptLanguage.RunScript(scripd);
            Runing = false;
        }
        public void Invoke(MessageEventArgs e)
        {
            while (Runing)
            {
                Thread.Sleep(100);
            }
            Runing = true;
            string scripd = Script;

            if (scripd.Contains("%"))
            {
                if (scripd.Contains("%TEXT%"))
                {
                    scripd = scripd.Replace("%TEXT%", e.Message.Replace("\n", "").Replace(">", "").Split(new char[] { ' ' }, 2).Last().Trim());
                }
                if (scripd.Contains("%NICK%"))
                {
                    scripd = scripd.Replace("%NICK%", e.NickName.Replace("\n", "").Trim());
                }
                //if (scripd.Contains("%TEXT%"))
                //  scripd = scripd.Replace("%TEXT%", e.Text.Replace("\n", ""));
            }
            ScriptLanguage.RunScript(scripd);
            Runing = false;
        }
Example #3
0
        public void invoke(RewardEventArgs e)
        {
            while (Runing)
            {
                Thread.Sleep(100);
            }
            Runing = true;
            string scripd = Script;

            if (scripd.Contains("%"))
            {
                if (scripd.Contains("%TEXT%"))
                {
                    scripd = scripd.Replace("%TEXT%", e.Text.Replace("\n", "").Trim());
                }
                if (scripd.Contains("%NICK%"))
                {
                    scripd = scripd.Replace("%NICK%", e.NickName.Replace("\n", "").Trim());
                }
                if (scripd.Contains("%TITLE%"))
                {
                    scripd = scripd.Replace("%TITLE%", e.Title.Replace("\n", "").Trim());
                }
                //if (scripd.Contains("%TEXT%"))
                //  scripd = scripd.Replace("%TEXT%", e.Text.Replace("\n", ""));
            }
            ScriptLanguage.RunScript(scripd);
            Runing = false;
        }
        public void Invoke(RewardEventArgs e)
        {
            while (Runing)
            {
                Thread.Sleep(100);
            }
            Runing = true;
            string scripd = Script;

            if (scripd != null && scripd.Contains("%"))
            {
                if (scripd.Contains("%TEXT%"))
                {
                    scripd = scripd.Replace("%TEXT%", e.Text.Replace("\n", "").Trim());
                }
                if (scripd.Contains("%NICK%"))
                {
                    scripd = scripd.Replace("%NICK%", e.NickName.Replace("\n", "").Trim());
                }
                if (scripd.Contains("%TITLE%"))
                {
                    scripd = scripd.Replace("%TITLE%", e.Title.Replace("\n", "").Trim());
                }
            }
            if (DeferredRun && !runEveryTime)
            {
                Deferred.Add(scripd);
                Runing = false;
            }
            else
            {
                if (scripd.Contains("%DATA%"))
                {
                    scripd = scripd.Replace("%DATA%", DefereData);
                }
                ScriptLanguage.RunScript(scripd);
                if (DeferredRun)
                {
                    Thread.Sleep(1000);
                }
                Runing = false;
            }
        }
 public void InvokeDeferred(string data)
 {
     DefereData = data;
     new Task(() => {
         while (Runing)
         {
             Thread.Sleep(100);
         }
         Runing = true;
         foreach (string scrip in Deferred)
         {
             string scripd = scrip;
             if (scripd.Contains("%DATA%"))
             {
                 scripd = scripd.Replace("%DATA%", data);
             }
             ScriptLanguage.RunScript(scripd);
             Thread.Sleep(1000);
         }
         Deferred.Clear();
         Runing = false;
     }).Start();
 }
 protected override void OnMessage(MessageEventArgs e)
 {
     if (e.Data == "Ping")
     {
         Send("Pong");
     }
     else
     {
         string[] Par = e.Data.Split('|');
         switch (Par[0])
         {
         case "timer.End":
             if (Par.Length > 1)
             {
                 if (ScriptLanguage.TimersEnds.ContainsKey(Par[1]))
                 {
                     ScriptLanguage.RunScript(ScriptLanguage.TimersEnds[Par[1]]);
                     ScriptLanguage.TimersEnds.Remove(Par[1]);
                 }
             }
             break;
         }
     }
 }