Exemple #1
0
 public Settings(FischerSettings settings, XiLib ffxi)
 {
     InitializeComponent();
     this.settings = settings;
     this.ffxi     = ffxi;
     ApplySettings(settings);
 }
Exemple #2
0
 public void OnClosing()
 {
     try
     {
         FischerSettings.Save(settings, ffxi.Player.Name);
         fischer.Stop();
     }
     catch (Exception ex)
     {
         ErrorLog.OnError(ex);
     }
 }
Exemple #3
0
 private void ApplySettings(FischerSettings settings)
 {
     textBox1.Text        = settings.NewChatLineScript;
     textBox2.Text        = settings.FullInventoryScript;
     textBox3.Text        = settings.ZoneChangeScript;
     textBox4.Text        = settings.NoRodScript;
     textBox5.Text        = settings.NoBaitScript;
     numericUpDown1.Value = settings.ReleaseDelayMin;
     numericUpDown2.Value = settings.ReleaseDelayMax;
     numericUpDown3.Value = settings.ReelInPercent;
     numericUpDown4.Value = settings.Fatigue;
     checkBox1.Checked    = settings.UseFatigue;
 }
Exemple #4
0
 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);
     }
 }
Exemple #5
0
 private void SaveSettings(FischerSettings settings, string name)
 {
     settings.IgnoreCatchList = chkIgnoreList.Checked;
     settings.ReleaseBig      = chkReleaseBig.Checked;
     settings.ReleaseChecked  = chkReleaseChecked.Checked;
     settings.ReleaseItem     = chkReleaseItem.Checked;
     settings.ReleaseMonster  = chkReleaseMonster.Checked;
     settings.ReleaseSmall    = chkReleaseSmall.Checked;
     settings.UseLeftRing     = chkUseLeftRing.Checked;
     settings.UseRightRing    = chkUseRightRing.Checked;
     settings.RecastDelay     = int.Parse(txtRecastDelay.Text);
     settings.ReelInDelay     = int.Parse(txtReelInDelay.Text);
     FischerSettings.Save(settings, name);
 }
Exemple #6
0
        /// <summary>
        ///  TODO: Update summary.
        /// </summary>
        /// <param name="pid">Process ID to attach to.</param>
        public Fischer(int pid, XiLib ffxi)
        {
            this.ffxi = ffxi;


            this.script     = new LuaScript(ffxi, this);
            this.fishScript = new LuaScript(ffxi, this);
            this.settings   = new FischerSettings();

            this.chatLog          = new ChatLog(ffxi);
            this.chatLog.NewLine += new ChatLog.NewLineEventHandler(chatLog_NewLine);
            this.chatLog.Listen();

            //this.alarm = new Alarm(chatLog, this, ffxi);
        }
Exemple #7
0
 private void ApplySettings(FischerSettings settings)
 {
     chkIgnoreList.Checked     = settings.IgnoreCatchList;
     chkReleaseBig.Checked     = settings.ReleaseBig;
     chkReleaseChecked.Checked = settings.ReleaseChecked;
     chkReleaseItem.Checked    = settings.ReleaseItem;
     chkReleaseMonster.Checked = settings.ReleaseMonster;
     chkReleaseSmall.Checked   = settings.ReleaseSmall;
     stpOnMn.Checked           = settings.StopOnMonster;
     chkUseLeftRing.Checked    = settings.UseLeftRing;
     chkUseRightRing.Checked   = settings.UseRightRing;
     txtRecastDelay.Text       = settings.RecastDelay.ToString();
     txtReelInDelay.Text       = settings.ReelInDelay.ToString();
     fischer.Settings          = settings;
 }
Exemple #8
0
        private void cmbProcs_SelectedIndexChanged(object sender, EventArgs e)
        {
            int pid = pol[cmbProcs.SelectedIndex].Pid;

            if (lastPid != pid)
            {
                List <CatchInfo> catchInfo = null;

                try
                {
                    ffxi    = new XiLib(pid, false);
                    fischer = new Fischer(pid, ffxi);
                }
                catch (Exception ex)
                {
                    ErrorLog.OnError(ex);
                }

                fischer.NewFish         += new Fischer.NewFishHandler(fischer_NewFish);
                fischer.FishCaught      += new Fischer.FishCaughtHandler(fischer_FishCaught);
                fischer.SkillUp         += new Fischer.SkillUpHandler(fischer_SkillUp);
                fischer.RunStateChanged += new Fischer.RunStateChangeHandler(fischer_RunStateChanged);

                uiTimer.Start();
                lastPid = pid;

                EquipmentStruct equip = ffxi.Inventory.GetEquipped();



                if (equip.Range.ItemIndex != 0)
                {
                    cmbRange.Text = ResourceParser.GetWeaponName(ffxi.Inventory.GetItemByIndex((Bag)equip.Range.BagID, equip.Range.ItemIndex).Value.ID);
                }

                if (equip.Ammo.ItemIndex != 0)
                {
                    cmbAmmo.Text = ResourceParser.GetWeaponName(ffxi.Inventory.GetItemByIndex((Bag)equip.Ammo.BagID, equip.Ammo.ItemIndex).Value.ID);
                }

                if (equip.LeftRing.ItemIndex != 0)
                {
                    cmbLeftRing.Text = ResourceParser.GetArmorName(ffxi.Inventory.GetItemByIndex((Bag)equip.LeftRing.BagID, equip.LeftRing.ItemIndex).Value.ID);
                }

                if (equip.RightRing.ItemIndex != 0)
                {
                    cmbRightRing.Text = ResourceParser.GetArmorName(ffxi.Inventory.GetItemByIndex((Bag)equip.RightRing.BagID, equip.RightRing.ItemIndex).Value.ID);
                }

                this.Text = ffxi.Player.Name;

                //try
                //{
                settings = FischerSettings.Load(ffxi.Player.Name);
                //}
                //catch (Exception ex)
                //{
                //    ErrorLog.OnError(ex);
                //}

                if (settings != null)
                {
                    ApplySettings(settings);
                }
                else
                {
                    settings = new FischerSettings();
                    settings.ReleaseDelayMax     = 5000;
                    settings.ReleaseDelayMin     = 2000;
                    settings.ReelInPercent       = 0;
                    settings.Fatigue             = 200;
                    settings.UseFatigue          = true;
                    settings.RecastDelay         = 8000;
                    settings.NewChatLineScript   = "scripts/default.lua";
                    settings.ZoneChangeScript    = "scripts/default.lua";
                    settings.FullInventoryScript = "scripts/default.lua";
                    settings.NoBaitScript        = "scripts/default.lua";
                    settings.NoRodScript         = "scripts/default.lua";
                }

                string path = string.Format("{0}/history/{1}_chistory.dat", Application.StartupPath, ffxi.Player.Name);

                if (File.Exists(path))
                {
                    if (lvCatchHistory.Items.Count > 0)
                    {
                        lvCatchHistory.Items.Clear();
                    }

                    //try
                    //{
                    catchInfo = catchHistory.Load(path);

                    foreach (CatchInfo ci in catchInfo)
                    {
                        string[] items = new string[3];

                        items[0] = ci.ID.ToString("X");
                        items[1] = ci.Name;
                        items[2] = ci.TimeStamp.ToString();

                        try
                        {
                            lvCatchHistory.Items.Add(new ListViewItem(items));
                        }
                        catch (Exception ex)
                        {
                            ErrorLog.OnError(ex);
                        }
                    }
                    //}
                    //catch (Exception ex)
                    //{
                    //    ErrorLog.OnError(ex);
                    //}

                    //try
                    //{
                    lvCatchHistory.Items[lvCatchHistory.Items.Count - 1].EnsureVisible();
                    //}
                    //catch (Exception ex)
                    //{
                    //    ErrorLog.OnError(ex);
                    //}
                }


                string path2 = string.Format("{0}/history/{1}_shistory.dat", Application.StartupPath, ffxi.Player.Name);

                if (File.Exists(path2))
                {
                    if (lvSkillHistory.Items.Count > 0)
                    {
                        lvSkillHistory.Items.Clear();
                    }

                    //try
                    //{
                    List <SkillInfo> skillInfo = skillHistory.Load(path2);

                    foreach (SkillInfo si in skillInfo)
                    {
                        string[] items = new string[2];

                        items[0] = si.Description;
                        items[1] = si.TimeStamp.ToString();

                        //try
                        //{
                        lvSkillHistory.Items.Add(new ListViewItem(items));
                        //}
                        //catch (Exception ex)
                        //{
                        //    ErrorLog.OnError(ex);
                        //}
                    }
                    //}
                    //catch (Exception ex)
                    //{
                    //    ErrorLog.OnError(ex);
                    //}

                    try
                    {
                        lvSkillHistory.Items[lvSkillHistory.Items.Count - 1].EnsureVisible();
                    }
                    catch (Exception ex)
                    {
                        ErrorLog.OnError(ex);
                    }
                }

                try
                {
                    if (catchHistory != null)
                    {
                        fishCountToday = GetTodaysFishCount(catchInfo);
                    }
                }
                catch (Exception ex)
                {
                    ErrorLog.OnError(ex);
                }
            }
        }
Exemple #9
0
 private void Settings_FormClosing(object sender, FormClosingEventArgs e)
 {
     FischerSettings.Save(settings, ffxi.Player.Name);
 }
Exemple #10
0
 private void okButton_Click(object sender, EventArgs e)
 {
     FischerSettings.Save(settings, ffxi.Player.Name);
     this.Close();
 }
Exemple #11
0
 public static void Save(FischerSettings settings, string name)
 {
     Utils.SerializeData <FischerSettings>(string.Format("settings/{0}.set", name), settings);
 }