Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
        public MainForm()
        {
            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");

            InitializeComponent();

            db.ExecuteNonQuery("create table if not exists settings(variable text, value text)");
            db.ExecuteNonQuery("create table if not exists items(position text, name text)");
            db.ExecuteNonQuery("create table if not exists button_labels(button_name text, " +
                "button_label text, use_job text)");
            db.ExecuteNonQuery("create table if not exists buttons(button_name text, " +
                "position text, value text)");
        }
Ejemplo n.º 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());
            }
        }
Ejemplo n.º 4
0
        public void Save()
        {
            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");
            Dictionary<String, String> data = new Dictionary<String, String>();

            db.Delete("settings", null);

            try {
                data.Add("variable", "opacity");
                data.Add("value", opacityChanger.Value.ToString());
                db.Insert("settings", data);
                data.Clear();

                data.Add("variable", "locationX");
                data.Add("value", parent.Location.X.ToString());
                db.Insert("settings", data);
                data.Clear();

                data.Add("variable", "locationY");
                data.Add("value", parent.Location.Y.ToString());
                db.Insert("settings", data);
                data.Clear();

                data.Add("variable", "actionwait");
                data.Add("value", actionWaitChanger.Value.ToString());
                db.Insert("settings", data);
                data.Clear();

                data.Add("variable", "hotkeysenabled");
                data.Add("value", hotkeysCheckbox.Checked.ToString());
                db.Insert("settings", data);
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
            }
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 6
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();
        }
Ejemplo n.º 7
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);
            }
        }
Ejemplo n.º 8
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");
            Dictionary<String, String> data = new Dictionary<String, String>();

            db.Delete("button_labels", String.Format("button_name = \"{0}\"", owner.Name));

            data.Add("button_name", owner.Name);
            data.Add("button_label", buttonLabel.Text);
            data.Add("use_job", useJobCheckbox.Checked.ToString());
            db.Insert("button_labels", data);
            owner.Text = buttonLabel.Text;
            owner.use_job = useJobCheckbox.Checked;
            data.Clear();

            db.Delete("buttons", String.Format("button_name = \"{0}\"", owner.Name));

            data.Add("button_name", owner.Name);
            data.Add("position", "");
            data.Add("value", "");

            // Ears
            data["position"] = "ears";
            data["value"] = earGear.Text;
            db.Insert("buttons", data);

            // Head
            data["position"] = "head";
            data["value"] = headGear.Text;
            db.Insert("buttons", data);

            // Neck
            data["position"] = "neck";
            data["value"] = neckGear.Text;
            db.Insert("buttons", data);

            // Pouch
            data["position"] = "pouch";
            data["value"] = pouchGear.Text;
            db.Insert("buttons", data);

            // Pack
            data["position"] = "pack";
            data["value"] = packGear.Text;
            db.Insert("buttons", data);

            // Throwing
            data["position"] = "throwing";
            data["value"] = throwingGear.Text;
            db.Insert("buttons", data);

            // Main Hand
            data["position"] = "mh";
            data["value"] = mainHandGear.Text;
            db.Insert("buttons", data);

            // Off Hand
            data["position"] = "oh";
            data["value"] = offHandGear.Text;
            db.Insert("buttons", data);

            // Body
            data["position"] = "body";
            data["value"] = bodyGear.Text;
            db.Insert("buttons", data);

            // Waist
            data["position"] = "waist";
            data["value"] = waistGear.Text;
            db.Insert("buttons", data);

            // Hands
            data["position"] = "hands";
            data["value"] = handGear.Text;
            db.Insert("buttons", data);

            // Legs
            data["position"] = "legs";
            data["value"] = legGear.Text;
            db.Insert("buttons", data);

            // Feet
            data["position"] = "feet";
            data["value"] = footGear.Text;
            db.Insert("buttons", data);

            // Wrists
            data["position"] = "wrists";
            data["value"] = wristGear.Text;
            db.Insert("buttons", data);

            // L.ring
            data["position"] = "L.ring";
            data["value"] = ring1.Text;
            db.Insert("buttons", data);

            // R.ring
            data["position"] = "R.ring";
            data["value"] = ring2.Text;
            db.Insert("buttons", data);

            this.Close();
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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;
                }
            }
        }
Ejemplo n.º 11
0
        private void LoadDataFromWeb()
        {
            SQLiteDatabase db = new SQLiteDatabase("ffxiv_job_bar.db");
            List<string> urls = new List<string>();

            urls.Add("/weapon/archer");
            urls.Add("/weapon/conjurer");
            urls.Add("/weapon/gladiator");
            urls.Add("/weapon/marauder");
            urls.Add("/weapon/lancer");
            urls.Add("/weapon/pugilist");
            urls.Add("/weapon/thaumaturge");
            urls.Add("/tool/alchemist");
            urls.Add("/tool/armorer");
            urls.Add("/tool/blacksmith");
            urls.Add("/tool/botanist");
            urls.Add("/tool/carpenter");
            urls.Add("/tool/culinarian");
            urls.Add("/tool/fisher");
            urls.Add("/tool/goldsmith");
            urls.Add("/tool/leatherworker");
            urls.Add("/tool/miner");
            urls.Add("/tool/weaver");
            urls.Add("/armor/head");
            urls.Add("/armor/body");
            urls.Add("/armor/hands");
            urls.Add("/armor/waist");
            urls.Add("/armor/legs");
            urls.Add("/armor/feet");
            urls.Add("/armor/shield");
            urls.Add("/armor/earring");
            urls.Add("/armor/bracelet");
            urls.Add("/armor/necklace");
            urls.Add("/armor/ring");

            db.Delete("items", null);

            String position = "";

            foreach (string url in urls) {
                HttpWebRequest request =
                    (HttpWebRequest)WebRequest.Create("http://mooglebox.com" + url + ".php");
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                Stream resStream = response.GetResponseStream();

                HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
                doc.Load(resStream);

                foreach (HtmlAgilityPack.HtmlNode item in doc.DocumentNode.SelectNodes("//a[@class='imPop']")) {
                    if (url.StartsWith("/weapon") || url.StartsWith("/tool")) {
                        if (item.InnerHtml.Trim().EndsWith("File") ||
                            item.InnerHtml.Trim().EndsWith("Mortar") ||
                            item.InnerHtml.Trim().EndsWith("Pliers") ||
                            item.InnerHtml.Trim().EndsWith("Scythe") ||
                            item.InnerHtml.Trim().EndsWith("Claw Hammer") ||
                            item.InnerHtml.Trim().EndsWith("Culinary Knife") ||
                            item.InnerHtml.Trim().EndsWith("Gig") ||
                            item.InnerHtml.Trim().EndsWith("Grinding Wheel") ||
                            item.InnerHtml.Trim().EndsWith("Awl") ||
                            item.InnerHtml.Trim().EndsWith("Sledgehammer") ||
                            item.InnerHtml.Trim().EndsWith("Spinning Wheel")) {
                            position = "oh";
                        }
                        else if (item.InnerHtml.Trim().EndsWith("Francisca") ||
                            item.InnerHtml.Trim().EndsWith("Throwing Dagger") ||
                            item.InnerHtml.Trim().EndsWith("Javalin") ||
                            item.InnerHtml.Trim().EndsWith("Azagai") ||
                            item.InnerHtml.Trim().EndsWith("Chakram")) {
                            position = "throwing";
                        }
                        else if (item.InnerHtml.Trim().EndsWith("Arrow")) {
                            position = "pack";
                        }
                        else {
                            position = "mh";
                        }
                    }
                    else if (url.EndsWith("shield"))
                        position = "oh";
                    else if (url.EndsWith("earring"))
                        position = "ears";
                    else if (url.EndsWith("bracelet"))
                        position = "wrists";
                    else if (url.EndsWith("necklace"))
                        position = "neck";
                    else
                        position = url.Substring(url.LastIndexOf("/") + 1);

                    db.ExecuteNonQuery(String.Format("insert into items values(\"{0}\", \"{1}\")",
                        position, item.InnerHtml.Trim()));
                }
            }
        }