All pastes #831249 Raw Edit

Stuff

public text v1 · immutable
#831249 ·published 2007-12-24 19:17 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ISXWoW;
using ISXWoW.WoWUI;
using InnerSpaceAPI;
using LavishScriptAPI;
using LavishVMAPI;

namespace ISXExperiments
{
    public partial class Form1 : Form
    {

        ISXWoW.ISXWoW WoW = new ISXWoW.ISXWoW();
        Random random = new Random();
        public Form1()
        {
            InitializeComponent();
        }

        public void methodSayCatch(object sender, LSEventArgs e)
        {
            manageMessage(sender, e, "SAY");
        }

        private void methodWhisperCatch(object sender, LSEventArgs e)
        {
            manageMessage(sender, e, "WHISPER");
        }

        private void manageMessage(object sender, LSEventArgs e, string response)
        {
            string Message = e.Args[2];
            string Author = e.Args[3];
            string Language = e.Args[4]; // Returns nothing WTF!
            string Status = e.Args[5];

            if (WoW.Me.Name.ToString() == Author)
                return;

            if (WoW.Me.FactionGroup.ToString() == "Alliance")
                Language = "Common";
            else
                Language = "Orcish";

            myConsole.AppendText("Message: " + Message + "\n" + "Author: " + Author + "\n" + "Language: " + WoW.Me.FactionGroup + "\n");

            Message = Message.ToLower();
            if (Message.Contains("wana do") || Message.Contains("want to"))
                sendMessage("No thanks, im busy.", Author, response, Language);
            
        }

        private void sendMessage(string Message, string Author, string type, string Language)
        {
            try
            {
                System.Threading.Thread.Sleep(random.Next(9000, 13000));
                using (new FrameLock(true))
                {
                    WoW.WoWScriptExecute("SendChatMessage(\"" + Message + "\", \"" + type + "\",\"" + Language + "\", \"" + Author + "\")");
                }
            }
            catch (Exception)
            {
                myConsole.AppendText("Error occured in sending message. \n");
            }
        }

        private void btnStatus_Click(object sender, EventArgs e)
        {
            try
            {
                using (new FrameLock(true))
                {
                    if (btnStatus.Text == "Activate")
                    {
                        btnStatus.Text = "Deactivate";
                        LavishScript.Events.AttachEventTarget("CHAT_MSG_WHISPER", methodWhisperCatch);
                        LavishScript.Events.AttachEventTarget("CHAT_MSG_SAY", methodSayCatch);
                    }
                    else
                    {
                        btnStatus.Text = "Activate";
                        LavishScript.Events.DetachEventTarget("CHAT_MSG_WHISPER", methodWhisperCatch);
                        LavishScript.Events.DetachEventTarget("CHAT_MSG_SAY", methodSayCatch);
                    }
                }
            }
            catch (Exception)
            {
                myConsole.AppendText("Error occured while pressing button. \n");
            }
        }
    }
}