private void toolStripButton2_Click(object sender, EventArgs e) { if (!fischer.IsRunning) { try { EquipmentStruct equip = ffxi.Inventory.GetEquipped(); if (equip.Ammo.ItemIndex != 0 && equip.Range.ItemIndex != 0) { fischer.Start(); fischer.BaitID = ffxi.Inventory.GetItemByIndex((Bag)equip.Ammo.BagID, equip.Ammo.ItemIndex).Value.ID; fischer.RodID = ffxi.Inventory.GetItemByIndex((Bag)equip.Range.BagID, equip.Range.ItemIndex).Value.ID; fischer.Settings = settings; } } catch (Exception ex) { ErrorLog.OnError(ex); } } else { try { fischer.Stop(); } catch (Exception ex) { ErrorLog.OnError(ex); } } }
private void zoneWorker() { int startZone = ffxi.Player.ZoneID; while (isRunning) { if (ffxi.Player.ZoneID != startZone) { try { if (!string.IsNullOrEmpty(settings.ZoneChangeScript)) { fishScript.Load(settings.ZoneChangeScript); fishScript.OnZoneChange(ffxi.Player.ZoneID); } } catch (Exception ex) { ErrorLog.OnError(ex); } } Thread.Sleep(1); } }
private void textBox2_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtReelInDelay.Text)) { try { fischer.ReelInDelay = int.Parse(txtReelInDelay.Text); } catch (FormatException ex) { MessageBox.Show(Errors.ERROR_FORMAT_INT, ex.GetType().ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { ErrorLog.OnError(ex); } try { settings.ReelInDelay = int.Parse(txtReelInDelay.Text); } catch (FormatException ex) { MessageBox.Show(Errors.ERROR_FORMAT_INT, ex.GetType().ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { ErrorLog.OnError(ex); } } }
public FishEntry[] GetAllEntries() { XmlDocument fishXml = new XmlDocument(); fishXml.Load(document); XmlNode node = fishXml.DocumentElement.SelectSingleNode("//zone[@id='" + zoneId.ToString("X") + "']"); if (node == null) //node doesn't exist { return(null); } FishEntry[] entries = new FishEntry[node.ChildNodes.Count]; int counter = 0; try { foreach (XmlNode child in node.ChildNodes) { entries[counter].ID = int.Parse(child.Attributes["id"].Value, NumberStyles.HexNumber); entries[counter].Name = child.Attributes["name"].Value; entries[counter].Checked = child.Attributes["checked"] == null ? false : bool.Parse(child.Attributes["checked"].Value); counter++; } } catch (Exception ex) { ErrorLog.OnError(ex); } return(entries); }
/// <summary> /// TODO: Update summary. /// </summary> public void Stop(string message) { if (isRunning) { isRunning = false; this.fishThread = null; RunStateChanged(this, new RunStateChangeEventArgs(isRunning, message)); // this.alarm.Stop(); try { if (script.Loaded) { script.OnStop(); } if (fishScript.Loaded) { fishScript.OnStop(); } } catch (Exception ex) { ErrorLog.OnError(ex); } } }
private void lvCatchList_ItemChecked(object sender, ItemCheckedEventArgs e) { List <CatchListEntry> catchEntries = new List <CatchListEntry>(); foreach (ListViewItem lvi in lvCatchList.Items) { CatchListEntry cle = new CatchListEntry(); cle.Checked = lvi.Checked; try { cle.ID = int.Parse(lvi.Text, NumberStyles.HexNumber); } catch (FormatException ex) { MessageBox.Show(Errors.ERROR_FORMAT_INT, ex.GetType().ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { ErrorLog.OnError(ex); } try { catchEntries.Add(cle); } catch (Exception ex) { ErrorLog.OnError(ex); } } try { fischer.CatchList = catchEntries; } catch (Exception ex) { ErrorLog.OnError(ex); } try { int id = int.Parse(e.Item.Text, NumberStyles.HexNumber); fischer.FishDict.SetChecked(id, e.Item.Checked); } catch (FormatException ex) { MessageBox.Show(Errors.ERROR_FORMAT_INT, ex.GetType().ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void pause() { try { fischer.Pause = true; } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void stop() { try { fischer.Stop(); } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e) { try { fischer.LeftRing = cmbLeftRing.Text; } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void resume() { try { fischer.Pause = false; } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void sleep(int ms) { try { Thread.Sleep(ms); } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void toolStripButton1_Click(object sender, EventArgs e) { try { updateComboBox(); } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { try { ffxi.Chat.SendString(string.Format("/equip ammo \"{0}\"", cmbAmmo.Text)); } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { try { AboutBox1 ab = new AboutBox1(); ab.ShowDialog(); } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void checkBox10_CheckedChanged(object sender, EventArgs e) { try { fischer.UseLeftRing = chkUseLeftRing.Checked; settings.UseLeftRing = chkUseLeftRing.Checked; } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void checkBox3_CheckedChanged(object sender, EventArgs e) { try { fischer.ReleaseMonster = chkReleaseMonster.Checked; settings.ReleaseMonster = chkReleaseMonster.Checked; } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void StpOnMn_CheckedChanged(object sender, EventArgs e) { try { fischer.StopOnMonster = stpOnMn.Checked; settings.StopOnMonster = stpOnMn.Checked; } catch (Exception ex) { ErrorLog.OnError(ex); } }
public void OnClosing() { try { FischerSettings.Save(settings, ffxi.Player.Name); fischer.Stop(); } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void fischer_FishCaught(object sender, FishCaughtEventArgs e) { CatchInfo ci = new CatchInfo(); ci.ID = e.ID; ci.Name = e.Name; ci.TimeStamp = DateTime.Now; try { catchHistory.Add(ci); } catch (Exception ex) { ErrorLog.OnError(ex); } string[] items = new string[3]; items[0] = e.ID.ToString("X"); items[1] = e.Name; items[2] = ci.TimeStamp.ToString(); try { Invoke(new MethodInvoker(delegate { lvCatchHistory.Items.Add(new ListViewItem(items)); })); } catch (Exception ex) { ErrorLog.OnError(ex); } try { Invoke(new MethodInvoker(delegate { lvCatchHistory.Items[lvCatchHistory.Items.Count - 1].EnsureVisible(); })); } catch (Exception ex) { ErrorLog.OnError(ex); } try { catchHistory.Save(string.Format("{0}/history/{1}_chistory.dat", Application.StartupPath, ffxi.Player.Name)); } catch (Exception ex) { ErrorLog.OnError(ex); } ++fishCountToday; }
public void ShowSettings() { try { Settings s = new Settings(settings, ffxi); s.ShowDialog(); settings = FischerSettings.Load(ffxi.Player.Name); fischer.Settings = settings; } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void NewTab() { try { BotForm bf = new BotForm(); bf.DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Document; bf.Show(dockPanel1); bf.Text = "New"; BotInstances.Add(bf); } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void fischer_SkillUp(object sender, SkillUpEventArgs e) { SkillInfo si = new SkillInfo(); si.Description = e.Description; si.TimeStamp = DateTime.Now; try { skillHistory.Add(si); } catch (Exception ex) { ErrorLog.OnError(ex); } string[] items = new string[2]; items[0] = e.Description; items[1] = si.TimeStamp.ToString(); try { Invoke(new MethodInvoker(delegate { lvSkillHistory.Items.Add(new ListViewItem(items)); })); } catch (Exception ex) { ErrorLog.OnError(ex); } try { Invoke(new MethodInvoker(delegate { lvSkillHistory.Items[lvSkillHistory.Items.Count - 1].EnsureVisible(); })); } catch (Exception ex) { ErrorLog.OnError(ex); } try { skillHistory.Save(string.Format("{0}/history/{1}_shistory.dat", Application.StartupPath, ffxi.Player.Name)); } catch (Exception ex) { ErrorLog.OnError(ex); } }
/// <summary> /// TODO: Update summary. /// </summary> public void Start() { if (!isRunning) { if (this.fishThread == null) { this.isRunning = true; this.fishThread = new Thread(new ThreadStart(fishWorker)); this.fishThread.IsBackground = true; this.fishThread.Start(); this.zoneThread = new Thread(new ThreadStart(zoneWorker)); this.zoneThread.IsBackground = true; this.zoneThread.Start(); this.gearThread = new Thread(new ThreadStart(gearWorker)); this.gearThread.IsBackground = true; this.gearThread.Start(); this.reelThread = new Thread(new ThreadStart(reelWorker)); this.reelThread.IsBackground = true; // this.alarm.Start(); RunStateChanged(this, new RunStateChangeEventArgs(isRunning)); try { if (script.Loaded) { script.OnStart(); } if (fishScript.Loaded) { fishScript.OnStart(); } } catch (Exception ex) { ErrorLog.OnError(ex); } } } }
private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { try { if (dockPanel1.ActiveContent is BotForm) { if (((BotForm)dockPanel1.ActiveContent).Fischer != null) { ((BotForm)dockPanel1.ActiveContent).ShowSettings(); } } } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { foreach (BotForm bf in BotInstances) { try { if (bf.Fischer != null) { bf.OnClosing(); } } catch (Exception ex) { ErrorLog.OnError(ex); } } }
private void dockPanel1_ContentRemoved(object sender, WeifenLuo.WinFormsUI.Docking.DockContentEventArgs e) { try { if (e.Content is BotForm) { if (((BotForm)e.Content).Fischer != null) { ((BotForm)e.Content).OnClosing(); } } } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void checkBox5_CheckedChanged(object sender, EventArgs e) { try { fischer.ReleaseChecked = chkReleaseChecked.Checked; settings.ReleaseChecked = chkReleaseChecked.Checked; if (chkReleaseChecked.CheckState == CheckState.Checked) { fischer.IgnoreCatchList = false; chkIgnoreList.Checked = false; settings.IgnoreCatchList = false; } } catch (Exception ex) { ErrorLog.OnError(ex); } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { try { ffxi.Chat.SendString(string.Format("/equip range \"{0}\"", cmbRange.Text)); } catch (Exception ex) { ErrorLog.OnError(ex); } if (!string.IsNullOrEmpty(cmbRange.Text)) { string path = string.Format("{0}/fish/{1}.xml", Application.StartupPath, cmbRange.Text); try { if (fischer.FishDict == null) { fischer.FishDict = new FishDictionary(ffxi.Player.ZoneID, path); } if (!File.Exists(path)) { fischer.FishDict.CreateNewFile(path, ffxi.Player.ZoneID); } fischer.FishDict.SetFile(path); if (!toolStripButton2.Enabled) { toolStripButton2.Enabled = true; } LoadZoneList(); } catch (Exception ex) { ErrorLog.OnError(ex); } } }
private void LoadZoneList() { lvCatchList.Items.Clear(); if (fischer.FishDict != null) { try { fischer.FishDict.SetZone(ffxi.Player.ZoneID); } catch (Exception ex) { ErrorLog.OnError(ex); } try { FishEntry[] fishEntries = fischer.FishDict.GetAllEntries(); if (fishEntries != null) { foreach (FishEntry f in fishEntries) { string[] elements = new string[2]; elements[0] = f.ID.ToString("X"); elements[1] = f.Name; ListViewItem lvi = new ListViewItem(elements); lvi.Checked = f.Checked; lvCatchList.Items.Add(lvi); } } } catch (Exception ex) { ErrorLog.OnError(ex); } } }
public FFXiScript(XiLib ffxi) { try { lua = new Lua(); } catch (Exception ex) { ErrorLog.OnError(ex); } this.ffxi = ffxi; try { RegisterFunctions(); } catch (Exception ex) { ErrorLog.OnError(ex); } }