示例#1
0
文件: Kefka.cs 项目: Fryheit/Kefka
        private async void OnBotStart(BotBase bot)
        {
            if (ff14bot.Managers.RoutineManager.Current.Name != "Kefka")
            {
                return;
            }

            OpenerManager.ResetOpeners();
            HotkeyManager.RegisterHotkeys();
            FormManager.ClassChange();
            DeepDive.DeepDiveInterruptOverride();
        }
示例#2
0
        public void OnInitialize(int version)
        {
            Logger.KefkaLog($"Initializing Version: GitHub {System.Windows.Forms.Application.ProductVersion}");

            TreeRoot.OnStart += OnBotStart;
            TreeRoot.OnStop  += OnBotStop;

            if (version == 2)
            {
                IsChineseVersion = true;
            }

            HookBehaviors();

            IgnoreTargetManager.ResetIgnoreTargets();
            TankBusterManager.ResetTankBusters();
            OpenerManager.ResetOpeners();
            CombatHelper.ResetLastUsed();
        }
示例#3
0
        public void OnInitialize(int version)
        {
            //Logger.KefkaLog($"Initializing Version: {File.ReadAllText(VersionPath)}");
            Logger.KefkaLog($"Initializing Version: GitHub 1.0.0");

            TreeRoot.OnStart += OnBotStart;
            TreeRoot.OnStop  += OnBotStop;

            if (version == 2)
            {
                IsChineseVersion = true;
            }

            HookBehaviors();

            var _class = RoutineManager.CurrentClass;

            InterruptManager.ResetInterrupts();
            IgnoreTargetManager.ResetIgnoreTargets();
            TankBusterManager.ResetTankBusters();
            OpenerManager.ResetOpeners();
            CombatHelper.ResetLastUsed();
        }
示例#4
0
        internal static async Task <bool> Opener()
        {
            if (Target == null || !Target.CanAttack)
            {
                return(false);
            }

            #region RoutineSwitch

            ThreadSafeObservableCollection <OpenerSpellInfo> openerList = null;

            switch (MainSettingsModel.Instance.CurrentRoutine)
            {
            case "Barret":
                openerList = Barret_OpenerViewModel.Instance.GuiOpenerList;
                break;

            case "Beatrix":
                openerList = Beatrix_OpenerViewModel.Instance.GuiOpenerList;
                break;

            case "Cecil":
                openerList = Cecil_OpenerViewModel.Instance.GuiOpenerList;
                break;

            case "Cyan":
                openerList = Cyan_OpenerViewModel.Instance.GuiOpenerList;
                break;

            case "Edward":
                openerList = Edward_OpenerViewModel.Instance.GuiOpenerList;
                break;

            case "Eiko":
                openerList = Eiko_OpenerViewModel.Instance.GuiOpenerList;
                break;

            case "Elayne":
                openerList = Elayne_OpenerViewModel.Instance.GuiOpenerList;
                break;

            case "Freya":
                openerList = Freya_OpenerViewModel.Instance.GuiOpenerList;
                break;

            case "Paine":
                openerList = Paine_OpenerViewModel.Instance.GuiOpenerList;
                break;

            case "Sabin":
                openerList = Sabin_OpenerViewModel.Instance.GuiOpenerList;
                break;

            case "Shadow":
                openerList = Shadow_OpenerViewModel.Instance.GuiOpenerList;
                break;

            case "Vivi":
                openerList = Vivi_OpenerViewModel.Instance.GuiOpenerList;
                break;
            }

            #endregion RoutineSwitch

            if (openerList != null)
            {
                var openerQueue = new Queue <OpenerSpellInfo>(openerList);

                if (openerQueue.Count == 0)
                {
                    Logger.KefkaLog(@"Opener queue is empty, please use the Reset Opener button to reset!");
                    openerQueue.Clear();
                    OpenerManager.ResetOpeners();
                    return(false);
                }

                while (Target != null && openerQueue.Count > 0)
                {
                    var nextOpener = openerQueue.Peek();
                    Logger.KefkaLog(@"Next Opener Skill: {0}", nextOpener.SpellName);

                    if (nextOpener.SpellName.Contains("Delay"))
                    {
                        var waitTime = TimeSpan.FromSeconds(nextOpener.SpellId).Duration();

                        await Coroutine.Wait(waitTime, () => false);

                        openerQueue.Dequeue();
                        continue;
                    }

                    if (nextOpener.IsItem)
                    {
                        var openerItem = InventoryManager.FilledSlots.FirstOrDefault(r => r.RawItemId == nextOpener.SpellId);

                        if (await Items.UsePotion(openerItem.Item, true))
                        {
                            openerQueue.Dequeue();
                            continue;
                        }
                    }

                    if (nextOpener.IsPet)
                    {
                        var petOpenerSpell = DataManager.GetPetSpellData(nextOpener.SpellName);

                        if (petOpenerSpell == null)
                        {
                            openerQueue.Dequeue();
                            continue;
                        }

                        if (PetManager.DoAction(petOpenerSpell.Name, Target))
                        {
                            Logger.KefkaLog("We're inside of the PetSpell Section.");
                            openerQueue.Dequeue();
                            continue;
                        }
                    }

                    var openerSpell = DataManager.GetSpellData(nextOpener.SpellId);
                    await Coroutine.Wait(3000, () => ActionManager.CanCast(openerSpell, Target) || ActionManager.CanCast(openerSpell, Me));

                    if (openerSpell == null)
                    {
                        openerQueue.Dequeue();
                    }

                    #region Routine Nuance Catches

                    switch (MainSettingsModel.Instance.CurrentRoutine)
                    {
                    case "Barret":
                        break;

                    case "Beatrix":
                        break;

                    case "Cecil":
                        break;

                    case "Cyan":
                        break;

                    case "Edward":
                        if (openerSpell == Spells.PitchPerfect)
                        {
                            await Coroutine.Wait((int)CombatHelper.GcdTimeRemaining, () => ActionResourceManager.Bard.Repertoire == 3);

                            if (ActionResourceManager.Bard.Repertoire != 3)
                            {
                                openerQueue.Dequeue();
                                continue;
                            }

                            if (await Spells.PitchPerfect.Use(Target, true))
                            {
                                openerQueue.Dequeue();
                                continue;
                            }
                        }
                        break;

                    case "Eiko":
                        break;

                    case "Elayne":
                        if (openerSpell == Spells.Verfire || openerSpell == Spells.Verstone)
                        {
                            await Coroutine.Wait((int)CombatHelper.GcdTimeRemaining, () => Me.HasAura(Auras.VerfireReady) || Me.HasAura(Auras.VerstoneReady));

                            if (!Me.HasAura(Auras.VerfireReady) && !Me.HasAura(Auras.VerstoneReady))
                            {
                                openerQueue.Dequeue();
                                continue;
                            }

                            if (Me.HasAura(Auras.VerfireReady))
                            {
                                if (await Spells.Verfire.Use(Target, true))
                                {
                                    openerQueue.Dequeue();
                                    continue;
                                }
                            }

                            if (Me.HasAura(Auras.VerstoneReady))
                            {
                                if (await Spells.Verstone.Use(Target, true))
                                {
                                    openerQueue.Dequeue();
                                    continue;
                                }
                            }
                        }
                        break;

                    case "Freya":
                        if (openerSpell == Spells.DragonSight)
                        {
                            if (await FreyaRotation.DragonSightOpener())
                            {
                                openerQueue.Dequeue();
                                continue;
                            }
                        }
                        break;

                    case "Paine":
                        break;

                    case "Sabin":
                        break;

                    case "Shadow":
                        break;

                    case "Vivi":
                        break;
                    }

                    #endregion Routine Nuance Catches

                    if (openerSpell?.Range == 0 && openerSpell.SpellType != SpellType.Weaponskill)
                    {
                        if (await openerSpell.UseOpenerSpell(Me, true))
                        {
                            Logger.KefkaLog("We're inside of the Regular Spell (ME) Section.");
                            openerQueue.Dequeue();
                            continue;
                        }
                    }

                    if (await openerSpell.UseOpenerSpell(Target, true))
                    {
                        Logger.KefkaLog("We're inside of the Regular Spell (TARGET) Section.");
                        openerQueue.Dequeue();
                    }

                    await Coroutine.Yield();
                }

                Logger.KefkaLog(@"Opener has completed, or was interrupted!");
                Core.OverlayManager.AddToast(() => "Opener Complete!", TimeSpan.FromMilliseconds(750), MainSettingsModel.Instance.ToastColor(true), Colors.White, new FontFamily("High Tower Text Italic"), new FontWeight(), 52);
                openerQueue.Clear();
            }
            OpenerManager.ResetOpeners();
            return(false);
        }