Пример #1
0
        public static Mobile Acquire(Predicate <Mobile> validator)
        {
            Mobile player = World.Player;

            if (player != null)
            {
                using (ScratchList <Mobile> scratchList = new ScratchList <Mobile>())
                {
                    List <Mobile>       mobileList          = scratchList.Value;
                    bool                isBola              = false;
                    int                 range               = Engine.ServerFeatures.AOS ? 11 : 12;
                    ServerTargetHandler serverTargetHandler = TargetManager.Active as ServerTargetHandler;
                    if (serverTargetHandler != null && serverTargetHandler.Action == TargetAction.Bola)
                    {
                        isBola = true;
                        range  = 8;
                    }
                    foreach (Mobile mobile in World.Mobiles.Values)
                    {
                        if (mobile.Visible && !mobile.Player && (!mobile.IsDead && TargetManager.IsAcquirable(player, mobile, isBola)) && (player.InRange((IPoint2D)mobile, range) && Map.LineOfSight(player, mobile) && (validator == null || validator(mobile))))
                        {
                            mobileList.Add(mobile);
                        }
                    }
                    if (mobileList.Count > 0)
                    {
                        mobileList.Sort(TargetSorter.Comparer);
                        return(mobileList[0]);
                    }
                }
            }
            return((Mobile)null);
        }
Пример #2
0
        public static void ProcessQueue()
        {
            ServerTargetHandler server = TargetManager.Server;

            if (server == null || TargetManager.queuedTarget == null)
            {
                return;
            }
            if (TargetManager.queuedTarget == TargetManager.smartSentinel)
            {
                if (server.IsOffensive)
                {
                    server.Target((object)TargetManager.lastOffensive);
                }
                else if (server.IsDefensive)
                {
                    server.Target((object)TargetManager.lastDefensive);
                }
                else
                {
                    server.Target(TargetManager.lastTarget);
                }
            }
            else
            {
                server.Target(TargetManager.queuedTarget);
            }
            TargetManager.queuedTarget = (object)null;
        }
Пример #3
0
        public static void Identify(TargetAction action)
        {
            ServerTargetHandler server = TargetManager.Server;

            if (server != null && server.StartTime + TargetActions.MarginOfError > DateTime.Now && server.Aggression == TargetActions.GetFlags(action))
            {
                server.Action = action;
            }
            else if (server != null)
            {
                server.Action = TargetAction.Unknown;
            }
            TargetActions.m_Lookahead = TargetAction.Unknown;
        }
Пример #4
0
        public static void Identify()
        {
            ServerTargetHandler server = TargetManager.Server;

            if (TargetActions.m_Lookahead != TargetAction.Unknown)
            {
                server.Action             = !(TargetActions.m_Creation + TargetActions.MarginOfError > DateTime.Now) || server == null || server.Aggression != TargetActions.GetFlags(TargetActions.m_Lookahead) ? TargetAction.Unknown : TargetActions.m_Lookahead;
                TargetActions.m_Lookahead = TargetAction.Unknown;
            }
            else if (server != null && server.Aggression == AggressionType.Defensive)
            {
                server.Action = TargetAction.GreaterHeal;
            }
            else
            {
                if (server == null)
                {
                    return;
                }
                server.Action = TargetAction.Unknown;
            }
        }