示例#1
0
文件: Plugin.cs 项目: herbfunk/Funky
        public void OnPulse()
        {
            if (!HookHandler.CheckCombatHook())
            {
                Logger.DBLog.Info("Hooking Combat!");
                HookHandler.HookCombat();
            }

            if (FunkyGame.GameIsInvalid)
            {
                return;
            }


            //in-game monitoring
            FunkyGame.Profile.CheckCurrentProfileBehavior();
            GoldInactivity.CheckTimeoutTripped();
            Hotbar.CheckSkills();
            Equipment.CheckEquippment();


            if (FunkyGame.AdventureMode)
            {
                FunkyGame.Bounty.CheckActiveBounty();
            }
        }
示例#2
0
        /// <summary>
        /// Check if we are stuck or not by simply checking for position changing max once every 3 seconds
        /// </summary>
        /// <param name="vMyCurrentPosition"></param>
        /// <param name="checkDuration"></param>
        /// <returns></returns>
        public static bool UnstuckChecker(Vector3 vMyCurrentPosition, int checkDuration = 3000)
        {
            // set checkDuration to 30 sec while in town or vendoring, just to avoid annoyances
            if (ZetaDia.Me.IsInTown || GilesTrinity.ForceVendorRunASAP || Zeta.CommonBot.Logic.BrainBehavior.IsVendoring)
            {
                checkDuration = 15000;
            }

            // Keep checking distance changes every 3 seconds
            if (DateTime.Now.Subtract(TimeLastRecordedPosition).TotalMilliseconds >= checkDuration)
            {
                if (ZetaDia.Me.IsInTown && (UIElements.VendorWindow.IsVisible || UIElements.SalvageWindow.IsVisible))
                {
                    UnStuckCheckerLastResult = false;
                    return(UnStuckCheckerLastResult);
                }

                if (checkDuration >= 3000)
                {
                    TimeLastRecordedPosition = DateTime.Now;
                }

                ProfileBehavior c = null;

                try
                {
                    if (ProfileManager.CurrentProfileBehavior != null)
                    {
                        c = ProfileManager.CurrentProfileBehavior;
                    }
                }
                catch { }

                if (c != null && c.GetType() == typeof(WaitTimerTag))
                {
                    vOldPosition = Vector3.Zero;
                    GoldInactivity.ResetCheckGold();
                    UnStuckCheckerLastResult = false;
                    return(UnStuckCheckerLastResult);
                }

                Zeta.Internals.UIElement vendorWindow = Zeta.Internals.UIElements.VendorWindow;

                // We're not stuck if we're doing stuff!
                if (ZetaDia.Me.IsInConversation || ZetaDia.IsPlayingCutscene || ZetaDia.IsLoadingWorld || (vendorWindow.IsValid && vendorWindow.IsVisible))
                {
                    vOldPosition = Vector3.Zero;
                    GoldInactivity.ResetCheckGold();
                    UnStuckCheckerLastResult = false;
                    return(UnStuckCheckerLastResult);
                }

                AnimationState aState = ZetaDia.Me.CommonData.AnimationState;
                // We're not stuck if we're doing stuff!
                if (aState == AnimationState.Attacking ||
                    aState == AnimationState.Casting ||
                    aState == AnimationState.Channeling)
                {
                    vOldPosition = Vector3.Zero;
                    GoldInactivity.ResetCheckGold();
                    UnStuckCheckerLastResult = false;
                    return(UnStuckCheckerLastResult);
                }

                if (vOldPosition != Vector3.Zero && vOldPosition.Distance(vMyCurrentPosition) <= 4f)
                {
                    UnStuckCheckerLastResult = true;
                    return(UnStuckCheckerLastResult);
                }

                if (checkDuration >= 3000)
                {
                    vOldPosition = vMyCurrentPosition;
                }
            }

            // Return last result if within the specified timeframe
            return(false);
        }