private void SettingsForm_Load(object sender, EventArgs e)
        {
            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");
            DataTable      settings;

            String query = "Select * from settings;";

            settings = db.GetDataTable(query);

            foreach (DataRow r in settings.Rows)
            {
                switch (r["variable"].ToString())
                {
                case "opacity":
                    this.opacityChanger.Value = Convert.ToInt32(r["value"].ToString());
                    break;

                case "actionwait":
                    this.actionWaitChanger.Value = Convert.ToInt32(r["value"].ToString());
                    break;

                case "hotkeysenabled":
                    this.hotkeysCheckbox.Checked = Convert.ToBoolean(r["value"].ToString());
                    break;
                }
            }
        }
Example #2
0
        private void ChangeJob()
        {
            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");
            DataTable settings;

            IntPtr ffHandle = NativeImports.FindWindow("RAPTURE", "FINAL FANTASY XIV");

            if (ffHandle == IntPtr.Zero) {
                MessageBox.Show("Final Fantasy is not running.");
                return;
            }

            String query =
                String.Format("select position, value from buttons where position = 'mh' " +
                    "and button_name = '{0}';", Name);
            settings = db.GetDataTable(query);
            if (settings.Rows.Count <= 0)
                return;
            if (settings.Rows[0]["value"].ToString().Trim() == "") {
                db.Delete("buttons", String.Format("button_name = \"{0}\"", Name));
                return;
            }
            ToggleButtonStates();
            SendMessage(ffHandle, String.Format("/equip mh \"{0}\"", settings.Rows[0]["value"].ToString()));
            if (use_job) {
                SendMessage(ffHandle, "/job on");
                Thread.Sleep(Math.Max(owner.actionWait * 3, 1000));
            }
            else {
                SendMessage(ffHandle, "/job off");
            }

            query = "select position, value from buttons where button_name = '" + Name +
                "' and position != 'mh';";
            settings = db.GetDataTable(query);

            foreach (DataRow r in settings.Rows) {
                String gearName = "";
                if (r["value"].ToString().Trim() == "")
                    continue;
                if (r["value"].ToString().Trim().ToLower() == "none") {
                    gearName = "";
                }
                else {
                    gearName = r["value"].ToString();
                }

                String equip = String.Format("/equip {0} \"{1}\"", r["position"], gearName);
                SendMessage(ffHandle, equip);
                if (r["position"].ToString() == "L.ring")
                    Thread.Sleep(Math.Max(owner.actionWait * 3, 1000));
                else
                    Thread.Sleep(owner.actionWait);
            }
            ToggleButtonStates();
        }
Example #3
0
        public void LoadSettings()
        {
            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");
            DataTable settings;

            String query = "select * from button_labels where button_name = \"" + Name + "\";";
            settings = db.GetDataTable(query);

            foreach (DataRow r in settings.Rows) {
                Text = r["button_label"].ToString();
                use_job = Convert.ToBoolean(r["use_job"].ToString());
            }
        }
Example #4
0
        public void LoadSettings()
        {
            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");
            DataTable      settings;

            String query = "select * from button_labels where button_name = \"" + Name + "\";";

            settings = db.GetDataTable(query);

            foreach (DataRow r in settings.Rows)
            {
                Text    = r["button_label"].ToString();
                use_job = Convert.ToBoolean(r["use_job"].ToString());
            }
        }
Example #5
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");
            DataTable settings;

            String query = "Select * from settings;";
            settings = db.GetDataTable(query);

            int x = 0, y = 0;
            foreach (DataRow r in settings.Rows) {
                switch (r["variable"].ToString()) {
                    case "opacity":
                        this.Opacity = Convert.ToDouble(r["value"].ToString()) / 100;
                        break;
                    case "locationX":
                        x = Convert.ToInt32(r["value"].ToString());
                        break;
                    case "locationY":
                        y = Convert.ToInt32(r["value"].ToString());
                        break;
                    case "actionwait":
                        this.actionWait = Convert.ToInt16(r["value"].ToString());
                        break;
                    case "hotkeysenabled":
                        this.hotkeysEnabled = Convert.ToBoolean(r["value"].ToString());
                        break;
                }
            }
            this.Location = new Point(x, y);
            this.Refresh();

            // Create all the job buttons
            sf = new SettingsForm(this);
            jcf = new JobConfigureForm();

            this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);
            sf.ItemDataChanged += new ItemDataChangedHandler(jcf.LoadItemData);
            Point point = new Point(0, 10);
            for (int i = 0; i < 20; i++) {
                JobButton b = new JobButton(this);

                if ((i > 0) && ((i % 10) == 0)) {
                    point.Y += 20;
                    point.X = 0;
                }
                else if (i > 0) {
                    point.X += 34;
                }

                b.Font = new System.Drawing.Font("Arial", 5.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                b.Location = point;
                b.Name = "JobButton" + (i + 1);
                b.Size = new System.Drawing.Size(35, 21);
                b.TabIndex = i;
                b.UseVisualStyleBackColor = true;
                panel2.Controls.Add(b);
                b.LoadSettings();
            }
        }
Example #6
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");
            DataTable      settings;

            String query = "Select * from settings;";

            settings = db.GetDataTable(query);

            int x = 0, y = 0;

            foreach (DataRow r in settings.Rows)
            {
                switch (r["variable"].ToString())
                {
                case "opacity":
                    this.Opacity = Convert.ToDouble(r["value"].ToString()) / 100;
                    break;

                case "locationX":
                    x = Convert.ToInt32(r["value"].ToString());
                    break;

                case "locationY":
                    y = Convert.ToInt32(r["value"].ToString());
                    break;

                case "actionwait":
                    this.actionWait = Convert.ToInt16(r["value"].ToString());
                    break;

                case "hotkeysenabled":
                    this.hotkeysEnabled = Convert.ToBoolean(r["value"].ToString());
                    break;
                }
            }
            this.Location = new Point(x, y);
            this.Refresh();

            // Create all the job buttons
            sf  = new SettingsForm(this);
            jcf = new JobConfigureForm();

            this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);
            sf.ItemDataChanged         += new ItemDataChangedHandler(jcf.LoadItemData);
            Point point = new Point(0, 10);

            for (int i = 0; i < 20; i++)
            {
                JobButton b = new JobButton(this);

                if ((i > 0) && ((i % 10) == 0))
                {
                    point.Y += 20;
                    point.X  = 0;
                }
                else if (i > 0)
                {
                    point.X += 34;
                }

                b.Font     = new System.Drawing.Font("Arial", 5.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                b.Location = point;
                b.Name     = "JobButton" + (i + 1);
                b.Size     = new System.Drawing.Size(35, 21);
                b.TabIndex = i;
                b.UseVisualStyleBackColor = true;
                panel2.Controls.Add(b);
                b.LoadSettings();
            }
        }
        public void LoadItemData(object sender, EventArgs e)
        {
            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");
            DataTable      data;

            try {
                // Ears
                String query = "select name from items where position = \"ears\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows)
                {
                    earGear.Items.Add(r["name"].ToString());
                }

                // Head
                query = "select name from items where position = \"head\";";
                data  = db.GetDataTable(query);
                foreach (DataRow r in data.Rows)
                {
                    headGear.Items.Add(r["name"].ToString());
                }

                // Neck
                DataTable neckData;
                query = "select name from items where position = \"neck\";";
                data  = db.GetDataTable(query);
                foreach (DataRow r in data.Rows)
                {
                    neckGear.Items.Add(r["name"].ToString());
                }

                // Pouch
                query = "select name from items where position = \"pouch\";";
                data  = db.GetDataTable(query);
                foreach (DataRow r in data.Rows)
                {
                    pouchGear.Items.Add(r["name"].ToString());
                }

                // Pack
                query = "select name from items where position = \"pack\";";
                data  = db.GetDataTable(query);
                foreach (DataRow r in data.Rows)
                {
                    packGear.Items.Add(r["name"].ToString());
                }

                // Throwing
                query = "select name from items where position = \"throwing\";";
                data  = db.GetDataTable(query);
                foreach (DataRow r in data.Rows)
                {
                    throwingGear.Items.Add(r["name"].ToString());
                }

                // Main Hand
                query = "select name from items where position = \"mh\";";
                data  = db.GetDataTable(query);
                foreach (DataRow r in data.Rows)
                {
                    mainHandGear.Items.Add(r["name"].ToString());
                }

                // Off Hand
                query = "select name from items where position = \"oh\";";
                data  = db.GetDataTable(query);
                foreach (DataRow r in data.Rows)
                {
                    offHandGear.Items.Add(r["name"].ToString());
                }

                // Body
                query = "select name from items where position = \"body\";";
                data  = db.GetDataTable(query);
                foreach (DataRow r in data.Rows)
                {
                    bodyGear.Items.Add(r["name"].ToString());
                }

                // Waist
                query = "select name from items where position = \"waist\";";
                data  = db.GetDataTable(query);
                foreach (DataRow r in data.Rows)
                {
                    waistGear.Items.Add(r["name"].ToString());
                }

                // Hands
                query = "select name from items where position = \"hands\";";
                data  = db.GetDataTable(query);
                foreach (DataRow r in data.Rows)
                {
                    handGear.Items.Add(r["name"].ToString());
                }

                // Legs
                query = "select name from items where position = \"legs\";";
                data  = db.GetDataTable(query);
                foreach (DataRow r in data.Rows)
                {
                    legGear.Items.Add(r["name"].ToString());
                }

                // Feet
                query = "select name from items where position = \"feet\";";
                data  = db.GetDataTable(query);
                foreach (DataRow r in data.Rows)
                {
                    footGear.Items.Add(r["name"].ToString());
                }

                // Wrists
                query = "select name from items where position = \"wrists\";";
                data  = db.GetDataTable(query);
                foreach (DataRow r in data.Rows)
                {
                    wristGear.Items.Add(r["name"].ToString());
                }

                // L.ring
                query = "select name from items where position = \"ring\";";
                data  = db.GetDataTable(query);
                foreach (DataRow r in data.Rows)
                {
                    ring1.Items.Add(r["name"].ToString());
                    ring2.Items.Add(r["name"].ToString());
                }
            }
            catch (Exception q) {
                MessageBox.Show(q.Message);
            }
        }
        protected override void OnVisibleChanged(EventArgs e)
        {
            if (this.Visible == false)
            {
                return;
            }

            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");
            DataTable      settings;

            String query = "select * from button_labels where button_name = \"" + owner.Name + "\";";

            settings = db.GetDataTable(query);

            if (settings.Rows.Count > 0)
            {
                buttonLabel.Text       = settings.Rows[0]["button_label"].ToString();
                useJobCheckbox.Checked = Convert.ToBoolean(settings.Rows[0]["use_job"].ToString());
            }
            else
            {
                buttonLabel.Text       = "";
                useJobCheckbox.Checked = false;
                earGear.Text           = "";
                headGear.Text          = "";
                neckGear.Text          = "";
                pouchGear.Text         = "";
                packGear.Text          = "";
                throwingGear.Text      = "";
                mainHandGear.Text      = "";
                offHandGear.Text       = "";
                bodyGear.Text          = "";
                waistGear.Text         = "";
                handGear.Text          = "";
                legGear.Text           = "";
                footGear.Text          = "";
                wristGear.Text         = "";
                ring1.Text             = "";
                ring2.Text             = "";
            }

            query    = "select * from buttons where button_name = \"" + owner.Name + "\";";
            settings = db.GetDataTable(query);

            foreach (DataRow r in settings.Rows)
            {
                switch (r["position"].ToString())
                {
                case "ears":
                    earGear.Text = r["value"].ToString();
                    break;

                case "head":
                    headGear.Text = r["value"].ToString();
                    break;

                case "neck":
                    neckGear.Text = r["value"].ToString();
                    break;

                case "pouch":
                    pouchGear.Text = r["value"].ToString();
                    break;

                case "pack":
                    packGear.Text = r["value"].ToString();
                    break;

                case "throwing":
                    throwingGear.Text = r["value"].ToString();
                    break;

                case "mh":
                    mainHandGear.Text = r["value"].ToString();
                    break;

                case "oh":
                    offHandGear.Text = r["value"].ToString();
                    break;

                case "body":
                    bodyGear.Text = r["value"].ToString();
                    break;

                case "waist":
                    waistGear.Text = r["value"].ToString();
                    break;

                case "hands":
                    handGear.Text = r["value"].ToString();
                    break;

                case "legs":
                    legGear.Text = r["value"].ToString();
                    break;

                case "feet":
                    footGear.Text = r["value"].ToString();
                    break;

                case "wrists":
                    wristGear.Text = r["value"].ToString();
                    break;

                case "L.ring":
                    ring1.Text = r["value"].ToString();
                    break;

                case "R.ring":
                    ring2.Text = r["value"].ToString();
                    break;
                }
            }

            base.OnVisibleChanged(e);
        }
Example #9
0
        private void ChangeJob()
        {
            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");
            DataTable      settings;

            IntPtr ffHandle = NativeImports.FindWindow("RAPTURE", "FINAL FANTASY XIV");

            if (ffHandle == IntPtr.Zero)
            {
                MessageBox.Show("Final Fantasy is not running.");
                return;
            }

            String query =
                String.Format("select position, value from buttons where position = 'mh' " +
                              "and button_name = '{0}';", Name);

            settings = db.GetDataTable(query);
            if (settings.Rows.Count <= 0)
            {
                return;
            }
            if (settings.Rows[0]["value"].ToString().Trim() == "")
            {
                db.Delete("buttons", String.Format("button_name = \"{0}\"", Name));
                return;
            }
            ToggleButtonStates();
            SendMessage(ffHandle, String.Format("/equip mh \"{0}\"", settings.Rows[0]["value"].ToString()));
            if (use_job)
            {
                SendMessage(ffHandle, "/job on");
                Thread.Sleep(Math.Max(owner.actionWait * 3, 1000));
            }
            else
            {
                SendMessage(ffHandle, "/job off");
            }

            query = "select position, value from buttons where button_name = '" + Name +
                    "' and position != 'mh';";
            settings = db.GetDataTable(query);

            foreach (DataRow r in settings.Rows)
            {
                String gearName = "";
                if (r["value"].ToString().Trim() == "")
                {
                    continue;
                }
                if (r["value"].ToString().Trim().ToLower() == "none")
                {
                    gearName = "";
                }
                else
                {
                    gearName = r["value"].ToString();
                }

                String equip = String.Format("/equip {0} \"{1}\"", r["position"], gearName);
                SendMessage(ffHandle, equip);
                if (r["position"].ToString() == "L.ring")
                {
                    Thread.Sleep(Math.Max(owner.actionWait * 3, 1000));
                }
                else
                {
                    Thread.Sleep(owner.actionWait);
                }
            }
            ToggleButtonStates();
        }
Example #10
0
        public void LoadItemData(object sender, EventArgs e)
        {
            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");
            DataTable data;

            try {
                // Ears
                String query = "select name from items where position = \"ears\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows) {
                    earGear.Items.Add(r["name"].ToString());
                }

                // Head
                query = "select name from items where position = \"head\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows) {
                    headGear.Items.Add(r["name"].ToString());
                }

                // Neck
                DataTable neckData;
                query = "select name from items where position = \"neck\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows) {
                    neckGear.Items.Add(r["name"].ToString());
                }

                // Pouch
                query = "select name from items where position = \"pouch\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows) {
                    pouchGear.Items.Add(r["name"].ToString());
                }

                // Pack
                query = "select name from items where position = \"pack\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows) {
                    packGear.Items.Add(r["name"].ToString());
                }

                // Throwing
                query = "select name from items where position = \"throwing\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows) {
                    throwingGear.Items.Add(r["name"].ToString());
                }

                // Main Hand
                query = "select name from items where position = \"mh\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows) {
                    mainHandGear.Items.Add(r["name"].ToString());
                }

                // Off Hand
                query = "select name from items where position = \"oh\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows) {
                    offHandGear.Items.Add(r["name"].ToString());
                }

                // Body
                query = "select name from items where position = \"body\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows) {
                    bodyGear.Items.Add(r["name"].ToString());
                }

                // Waist
                query = "select name from items where position = \"waist\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows) {
                    waistGear.Items.Add(r["name"].ToString());
                }

                // Hands
                query = "select name from items where position = \"hands\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows) {
                    handGear.Items.Add(r["name"].ToString());
                }

                // Legs
                query = "select name from items where position = \"legs\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows) {
                    legGear.Items.Add(r["name"].ToString());
                }

                // Feet
                query = "select name from items where position = \"feet\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows) {
                    footGear.Items.Add(r["name"].ToString());
                }

                // Wrists
                query = "select name from items where position = \"wrists\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows) {
                    wristGear.Items.Add(r["name"].ToString());
                }

                // L.ring
                query = "select name from items where position = \"ring\";";
                data = db.GetDataTable(query);
                foreach (DataRow r in data.Rows) {
                    ring1.Items.Add(r["name"].ToString());
                    ring2.Items.Add(r["name"].ToString());
                }
            }
            catch (Exception q) {
                MessageBox.Show(q.Message);
            }
        }
Example #11
0
        protected override void OnVisibleChanged(EventArgs e)
        {
            if (this.Visible == false)
                return;

            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");
            DataTable settings;

            String query = "select * from button_labels where button_name = \"" + owner.Name + "\";";
            settings = db.GetDataTable(query);

            if (settings.Rows.Count > 0) {
                buttonLabel.Text = settings.Rows[0]["button_label"].ToString();
                useJobCheckbox.Checked = Convert.ToBoolean(settings.Rows[0]["use_job"].ToString());
            }
            else {
                buttonLabel.Text = "";
                useJobCheckbox.Checked = false;
                earGear.Text = "";
                headGear.Text = "";
                neckGear.Text = "";
                pouchGear.Text = "";
                packGear.Text = "";
                throwingGear.Text = "";
                mainHandGear.Text = "";
                offHandGear.Text = "";
                bodyGear.Text = "";
                waistGear.Text = "";
                handGear.Text = "";
                legGear.Text = "";
                footGear.Text = "";
                wristGear.Text = "";
                ring1.Text = "";
                ring2.Text = "";
            }

            query = "select * from buttons where button_name = \"" + owner.Name + "\";";
            settings = db.GetDataTable(query);

            foreach (DataRow r in settings.Rows) {
                switch (r["position"].ToString()) {
                    case "ears":
                        earGear.Text = r["value"].ToString();
                        break;
                    case "head":
                        headGear.Text = r["value"].ToString();
                        break;
                    case "neck":
                        neckGear.Text = r["value"].ToString();
                        break;
                    case "pouch":
                        pouchGear.Text = r["value"].ToString();
                        break;
                    case "pack":
                        packGear.Text = r["value"].ToString();
                        break;
                    case "throwing":
                        throwingGear.Text = r["value"].ToString();
                        break;
                    case "mh":
                        mainHandGear.Text = r["value"].ToString();
                        break;
                    case "oh":
                        offHandGear.Text = r["value"].ToString();
                        break;
                    case "body":
                        bodyGear.Text = r["value"].ToString();
                        break;
                    case "waist":
                        waistGear.Text = r["value"].ToString();
                        break;
                    case "hands":
                        handGear.Text = r["value"].ToString();
                        break;
                    case "legs":
                        legGear.Text = r["value"].ToString();
                        break;
                    case "feet":
                        footGear.Text = r["value"].ToString();
                        break;
                    case "wrists":
                        wristGear.Text = r["value"].ToString();
                        break;
                    case "L.ring":
                        ring1.Text = r["value"].ToString();
                        break;
                    case "R.ring":
                        ring2.Text = r["value"].ToString();
                        break;
                }
            }

            base.OnVisibleChanged(e);
        }
Example #12
0
        private void SettingsForm_Load(object sender, EventArgs e)
        {
            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");
            DataTable settings;

            String query = "Select * from settings;";
            settings = db.GetDataTable(query);

            foreach (DataRow r in settings.Rows) {
                switch (r["variable"].ToString()) {
                    case "opacity":
                        this.opacityChanger.Value = Convert.ToInt32(r["value"].ToString());
                        break;
                    case "actionwait":
                        this.actionWaitChanger.Value = Convert.ToInt32(r["value"].ToString());
                        break;
                    case "hotkeysenabled":
                        this.hotkeysCheckbox.Checked = Convert.ToBoolean(r["value"].ToString());
                        break;
                }
            }
        }