Example #1
0
        public LuaScript(XiLib ffxi, Fischer fischer) : base(ffxi)
        {
            this.ffxi    = ffxi;
            this.fischer = fischer;

            //try
            //{
            //    RegisterFunctions();
            //}
            //catch (Exception ex)
            //{
            //    ErrorLog.OnError(ex);
            //}
        }
Example #2
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);
                }
            }
        }