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(); }
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); } }
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); } }
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(); }
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())); } } }
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(); }
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(); }
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())); } } }