Пример #1
0
        public static void TargetSelf(bool forceQ)
        {
            if (World.Player == null)
            {
                return;
            }

            //if ( Macros.MacroManager.AcceptActions )
            //	MacroManager.Action( new TargetSelfAction() );

            if (m_HasTarget)
            {
                if (!DoTargetSelf())
                {
                    ResendTarget();
                }
            }
            else if (forceQ || Config.GetBool("QueueTargets"))
            {
                if (!forceQ)
                {
                    World.Player.OverheadMessage(LocString.QueuedTS);
                }
                m_QueueTarget = TargetSelfAction;
            }
        }
Пример #2
0
        public static void LastTarget(bool forceQ)
        {
            //if ( Macros.MacroManager.AcceptActions )
            //	MacroManager.Action( new LastTargetAction() );

            if (m_HasTarget)
            {
                if (!DoLastTarget())
                {
                    ResendTarget();
                }
            }
            else if (forceQ || Config.GetBool("QueueTargets"))
            {
                if (!forceQ)
                {
                    if (Config.GetBool("ShowTargetSelfLastClearOverhead"))
                    {
                        World.Player.OverheadMessage(LocString.QueuedLT);
                    }
                    else
                    {
                        World.Player.SendMessage(MsgLevel.Force, LocString.QueuedLT);
                    }
                }

                m_QueueTarget = LastTargetAction;
            }
        }
Пример #3
0
        private QueueTarget CreateQueueTarget(TargetTypes targetType)
        {
            var queueTarget = new QueueTarget(_queueTargetId, 0, 0, targetType);

            _queueTargetId++;

            return(queueTarget);
        }
Пример #4
0
 internal static void SetAutoTarget(uint serial)
 {
     m_AutoTarget        = new TargetInfo();
     m_AutoTarget.Serial = new Serial(serial);
     m_QueueTarget       = AutoTargetAction;
     if (m_HasTarget)
     {
         if (!DoAutoTarget())
         {
             ResendTarget();
         }
     }
 }
Пример #5
0
        public static void TargetLast(bool forceQ)
        {
            //if ( Macros.MacroManager.AcceptActions )
            //	MacroManager.Action( new LastTargetAction() );

            if (m_HasTarget)
            {
                if (!DoLastTarget())
                {
                    ResendTarget();
                }
            }
            else if (forceQ || Config.GetBool("QueueTargets"))
            {
                m_QueueTarget = LastTargetAction;
            }
        }
Пример #6
0
 internal static void LastTarget(bool forceQ)
 {
     if (m_HasTarget)
     {
         if (!DoLastTarget())
         {
             ResendTarget();
         }
     }
     else if (forceQ || RazorEnhanced.Settings.General.ReadBool("QueueTargets"))
     {
         if (!forceQ)
         {
             World.Player.OverheadMessage(LocString.QueuedLT);
         }
         m_QueueTarget = LastTargetAction;
     }
 }
        protected override void Initialize(LSEventArgs copy)
        {
            var methodName = "Initialize";

            base.Initialize(copy);

            Int64       targetEntityId;
            int         targetPriority, targetSubPriority;
            DateTime    targetTimeQueued;
            TargetTypes targetType;

            if (copy.Args.Length < 7)
            {
                _logging.LogMessage(ObjectName, methodName, LogSeverityTypes.Standard, "Args array is is missing elements.");
                return;
            }

            if (!Int64.TryParse(copy.Args[2], out targetEntityId))
            {
                _logging.LogMessage(ObjectName, methodName, LogSeverityTypes.Standard, "Unable to parse target entity ID {0}", copy.Args[2]);
            }

            if (!int.TryParse(copy.Args[3], out targetPriority))
            {
                _logging.LogMessage(ObjectName, methodName, LogSeverityTypes.Standard, "Unable to parse target priority {0}", copy.Args[3]);
            }

            if (!int.TryParse(copy.Args[4], out targetSubPriority))
            {
                _logging.LogMessage(ObjectName, methodName, LogSeverityTypes.Standard, "Unable to parse target sub priority {0}", copy.Args[4]);
            }

            if (!DateTime.TryParse(copy.Args[5], out targetTimeQueued))
            {
                _logging.LogMessage(ObjectName, methodName, LogSeverityTypes.Standard, "Unable to parse target time queued {0}", copy.Args[5]);
            }

            if (!TargetTypes.TryParse(copy.Args[6], out targetType))
            {
                _logging.LogMessage(ObjectName, methodName, LogSeverityTypes.Standard, "Unable to parse target type {0}", copy.Args[6]);
            }

            Target = new QueueTarget(targetEntityId, targetPriority, targetSubPriority, targetType);
        }
Пример #8
0
        internal static void TargetSelf(bool forceQ)
        {
            if (World.Player == null)
            {
                return;
            }

            if (m_HasTarget)
            {
                if (!DoTargetSelf())
                {
                    ResendTarget();
                }
            }
            else if (forceQ || RazorEnhanced.Settings.General.ReadBool("QueueTargets"))
            {
                if (!forceQ)
                {
                    World.Player.OverheadMessage(LocString.QueuedTS);
                }
                m_QueueTarget = TargetSelfAction;
            }
        }
        internal static void WritePhase(IEmitter emitter, IPhase phase, Boolean noBootstrap = false)
        {
            if (!noBootstrap)
            {
                emitter.Emit(new MappingStart());
            }

            if (phase is PhasesTemplateReference)
            {
                var reference = phase as PhasesTemplateReference;
                if (!noBootstrap)
                {
                    emitter.Emit(new Scalar(YamlConstants.Template));
                    emitter.Emit(new Scalar(reference.Name));
                    if (reference.Parameters != null && reference.Parameters.Count > 0)
                    {
                        emitter.Emit(new Scalar(YamlConstants.Parameters));
                        WriteMapping(emitter, reference.Parameters);
                    }
                }

                if (reference.PhaseSelectors != null && reference.PhaseSelectors.Count > 0)
                {
                    emitter.Emit(new Scalar(YamlConstants.Phases));
                    emitter.Emit(new SequenceStart(null, null, true, SequenceStyle.Block));
                    foreach (PhaseSelector selector in reference.PhaseSelectors)
                    {
                        emitter.Emit(new MappingStart());
                        if (!String.IsNullOrEmpty(selector.Name))
                        {
                            emitter.Emit(new Scalar(YamlConstants.Name));
                            emitter.Emit(new Scalar(selector.Name));
                        }

                        if (selector.StepOverrides != null && selector.StepOverrides.Count > 0)
                        {
                            emitter.Emit(new Scalar(YamlConstants.Steps));
                            WriteStepOverrides(emitter, selector.StepOverrides);
                        }

                        emitter.Emit(new MappingEnd());
                    }

                    emitter.Emit(new SequenceEnd());
                }

                WriteStep(emitter, reference as StepsTemplateReference, noBootstrap: true);
            }
            else
            {
                var p = phase as Phase;
                if (!noBootstrap)
                {
                    emitter.Emit(new Scalar(YamlConstants.Name));
                    emitter.Emit(new Scalar(p.Name ?? String.Empty));
                }

                if (p.DependsOn != null && p.DependsOn.Count > 0)
                {
                    emitter.Emit(new Scalar(YamlConstants.DependsOn));
                    if (p.DependsOn.Count == 1)
                    {
                        emitter.Emit(new Scalar(p.DependsOn[0]));
                    }
                    else
                    {
                        WriteSequence(emitter, p.DependsOn);
                    }
                }

                if (!String.IsNullOrEmpty(p.Condition))
                {
                    emitter.Emit(new Scalar(YamlConstants.Condition));
                    emitter.Emit(new Scalar(p.Condition));
                }

                if (!String.IsNullOrEmpty(p.ContinueOnError))
                {
                    emitter.Emit(new Scalar(YamlConstants.ContinueOnError));
                    emitter.Emit(new Scalar(p.ContinueOnError));
                }

                if (!String.IsNullOrEmpty(p.EnableAccessToken))
                {
                    emitter.Emit(new Scalar(YamlConstants.EnableAccessToken));
                    emitter.Emit(new Scalar(p.EnableAccessToken));
                }

                if (p.Target != null)
                {
                    QueueTarget queueTarget = null;
                    DeploymentTarget deploymentTarget = null;
                    ServerTarget serverTarget = null;
                    if ((queueTarget = p.Target as QueueTarget) != null)
                    {
                        emitter.Emit(new Scalar(YamlConstants.Queue));

                        // Test for the simple case "queue: name".
                        if (!String.IsNullOrEmpty(queueTarget.Name) &&
                            String.IsNullOrEmpty(queueTarget.ContinueOnError) &&
                            String.IsNullOrEmpty(queueTarget.Parallel) &&
                            String.IsNullOrEmpty(queueTarget.TimeoutInMinutes) &&
                            (queueTarget.Demands == null || queueTarget.Demands.Count == 0) &&
                            (queueTarget.Matrix == null || queueTarget.Matrix.Count == 0))
                        {
                            emitter.Emit(new Scalar(queueTarget.Name));
                        }
                        else // Otherwise write the mapping.
                        {
                            emitter.Emit(new MappingStart());
                            if (!String.IsNullOrEmpty(queueTarget.Name))
                            {
                                emitter.Emit(new Scalar(YamlConstants.Name));
                                emitter.Emit(new Scalar(queueTarget.Name));
                            }

                            if (!String.IsNullOrEmpty(queueTarget.ContinueOnError))
                            {
                                emitter.Emit(new Scalar(YamlConstants.ContinueOnError));
                                emitter.Emit(new Scalar(queueTarget.ContinueOnError));
                            }

                            if (!String.IsNullOrEmpty(queueTarget.Parallel))
                            {
                                emitter.Emit(new Scalar(YamlConstants.Parallel));
                                emitter.Emit(new Scalar(queueTarget.Parallel));
                            }

                            if (!String.IsNullOrEmpty(queueTarget.TimeoutInMinutes))
                            {
                                emitter.Emit(new Scalar(YamlConstants.TimeoutInMinutes));
                                emitter.Emit(new Scalar(queueTarget.TimeoutInMinutes));
                            }

                            if (queueTarget.Demands != null && queueTarget.Demands.Count > 0)
                            {
                                emitter.Emit(new Scalar(YamlConstants.Demands));
                                if (queueTarget.Demands.Count == 1)
                                {
                                    emitter.Emit(new Scalar(queueTarget.Demands[0]));
                                }
                                else
                                {
                                    WriteSequence(emitter, queueTarget.Demands);
                                }
                            }

                            if (queueTarget.Matrix != null && queueTarget.Matrix.Count > 0)
                            {
                                emitter.Emit(new Scalar(YamlConstants.Matrix));
                                emitter.Emit(new MappingStart());
                                foreach (KeyValuePair<String, IDictionary<String, String>> pair in queueTarget.Matrix.OrderBy(x => x.Key, StringComparer.OrdinalIgnoreCase))
                                {
                                    emitter.Emit(new Scalar(pair.Key));
                                    WriteMapping(emitter, pair.Value);
                                }

                                emitter.Emit(new MappingEnd());
                            }

                            emitter.Emit(new MappingEnd());
                        }
                    }
                    else if ((deploymentTarget = p.Target as DeploymentTarget) != null)
                    {
                        emitter.Emit(new Scalar(YamlConstants.Deployment));

                        // Test for the simple case "deployment: group".
                        if (!String.IsNullOrEmpty(deploymentTarget.Group) &&
                            String.IsNullOrEmpty(deploymentTarget.ContinueOnError) &&
                            String.IsNullOrEmpty(deploymentTarget.HealthOption) &&
                            String.IsNullOrEmpty(deploymentTarget.Percentage) &&
                            String.IsNullOrEmpty(deploymentTarget.TimeoutInMinutes) &&
                            (deploymentTarget.Tags == null || deploymentTarget.Tags.Count == 0))
                        {
                            emitter.Emit(new Scalar(deploymentTarget.Group));
                        }
                        else // Otherwise write the mapping.
                        {
                            emitter.Emit(new MappingStart());
                            if (!String.IsNullOrEmpty(deploymentTarget.Group))
                            {
                                emitter.Emit(new Scalar(YamlConstants.Group));
                                emitter.Emit(new Scalar(deploymentTarget.Group));
                            }

                            if (!String.IsNullOrEmpty(deploymentTarget.ContinueOnError))
                            {
                                emitter.Emit(new Scalar(YamlConstants.ContinueOnError));
                                emitter.Emit(new Scalar(deploymentTarget.ContinueOnError));
                            }

                            if (!String.IsNullOrEmpty(deploymentTarget.HealthOption))
                            {
                                emitter.Emit(new Scalar(YamlConstants.HealthOption));
                                emitter.Emit(new Scalar(deploymentTarget.HealthOption));
                            }

                            if (!String.IsNullOrEmpty(deploymentTarget.Percentage))
                            {
                                emitter.Emit(new Scalar(YamlConstants.Percentage));
                                emitter.Emit(new Scalar(deploymentTarget.Percentage));
                            }

                            if (!String.IsNullOrEmpty(deploymentTarget.TimeoutInMinutes))
                            {
                                emitter.Emit(new Scalar(YamlConstants.TimeoutInMinutes));
                                emitter.Emit(new Scalar(deploymentTarget.TimeoutInMinutes));
                            }

                            if (deploymentTarget.Tags != null && deploymentTarget.Tags.Count > 0)
                            {
                                emitter.Emit(new Scalar(YamlConstants.Tags));
                                if (deploymentTarget.Tags.Count == 1)
                                {
                                    emitter.Emit(new Scalar(deploymentTarget.Tags[0]));
                                }
                                else
                                {
                                    WriteSequence(emitter, deploymentTarget.Tags);
                                }
                            }

                            emitter.Emit(new MappingEnd());
                        }
                    }
                    else if ((serverTarget = p.Target as ServerTarget) != null)
                    {
                        emitter.Emit(new Scalar(YamlConstants.Server));

                        // Test for the simple case "server: true".
                        if (String.IsNullOrEmpty(serverTarget.ContinueOnError) &&
                            String.IsNullOrEmpty(serverTarget.Parallel) &&
                            String.IsNullOrEmpty(serverTarget.TimeoutInMinutes) &&
                            (serverTarget.Matrix == null || serverTarget.Matrix.Count == 0))
                        {
                            emitter.Emit(new Scalar("true"));
                        }
                        else // Otherwise write the mapping.
                        {
                            emitter.Emit(new MappingStart());
                            if (!String.IsNullOrEmpty(serverTarget.ContinueOnError))
                            {
                                emitter.Emit(new Scalar(YamlConstants.ContinueOnError));
                                emitter.Emit(new Scalar(serverTarget.ContinueOnError));
                            }

                            if (!String.IsNullOrEmpty(serverTarget.Parallel))
                            {
                                emitter.Emit(new Scalar(YamlConstants.Parallel));
                                emitter.Emit(new Scalar(serverTarget.Parallel));
                            }

                            if (!String.IsNullOrEmpty(serverTarget.TimeoutInMinutes))
                            {
                                emitter.Emit(new Scalar(YamlConstants.TimeoutInMinutes));
                                emitter.Emit(new Scalar(serverTarget.TimeoutInMinutes));
                            }

                            if (serverTarget.Matrix != null && serverTarget.Matrix.Count > 0)
                            {
                                emitter.Emit(new Scalar(YamlConstants.Matrix));
                                emitter.Emit(new MappingStart());
                                foreach (KeyValuePair<String, IDictionary<String, String>> pair in serverTarget.Matrix.OrderBy(x => x.Key, StringComparer.OrdinalIgnoreCase))
                                {
                                    emitter.Emit(new Scalar(pair.Key));
                                    WriteMapping(emitter, pair.Value);
                                }

                                emitter.Emit(new MappingEnd());
                            }

                            emitter.Emit(new MappingEnd());
                        }
                    }
                    else
                    {
                        throw new NotSupportedException($"Unexpected target type: '{p.Target.GetType().FullName}'");
                    }
                }

                if (p.Variables != null && p.Variables.Count > 0)
                {
                    emitter.Emit(new Scalar(YamlConstants.Variables));
                    WriteVariables(emitter, p.Variables);
                }

                if (p.Steps != null && p.Steps.Count > 0)
                {
                    emitter.Emit(new Scalar(YamlConstants.Steps));
                    WriteSteps(emitter, p.Steps);
                }
            }

            if (!noBootstrap)
            {
                emitter.Emit(new MappingEnd());
            }
        }
        internal static QueueTarget ReadQueueTarget(IParser parser)
        {
            // Handle the simple case "queue: name"
            if (parser.Accept<Scalar>())
            {
                return new QueueTarget() { Name = ReadNonEmptyString(parser) };
            }

            var result = new QueueTarget();
            parser.Expect<MappingStart>();
            while (parser.Allow<MappingEnd>() == null)
            {
                Scalar scalar = parser.Expect<Scalar>();
                switch (scalar.Value ?? String.Empty)
                {
                    case YamlConstants.ContinueOnError:
                        result.ContinueOnError = ReadNonEmptyString(parser);
                        break;

                    case YamlConstants.Demands:
                        if (parser.Accept<Scalar>())
                        {
                            scalar = parser.Expect<Scalar>();
                            if (!String.IsNullOrEmpty(scalar.Value))
                            {
                                result.Demands = new List<String>();
                                result.Demands.Add(scalar.Value);
                            }
                        }
                        else
                        {
                            result.Demands = ReadSequenceOfString(parser);
                        }

                        break;

                    case YamlConstants.Matrix:
                        parser.Expect<MappingStart>();
                        result.Matrix = new Dictionary<String, IDictionary<String, String>>(StringComparer.OrdinalIgnoreCase);
                        while (parser.Allow<MappingEnd>() == null)
                        {
                            String key = ReadNonEmptyString(parser);
                            result.Matrix[key] = ReadMappingOfStringString(parser, StringComparer.OrdinalIgnoreCase);
                        }

                        break;

                    case YamlConstants.Name:
                        result.Name = ReadNonEmptyString(parser);
                        break;

                    case YamlConstants.Parallel:
                        result.Parallel = ReadNonEmptyString(parser);
                        break;

                    case YamlConstants.TimeoutInMinutes:
                        result.TimeoutInMinutes = ReadNonEmptyString(parser);
                        break;

                    default:
                        throw new SyntaxErrorException(scalar.Start, scalar.End, $"Unexpected property: '{scalar.Value}'");
                }
            }

            return result;
        }
Пример #11
0
 public static void ClearQueue()
 {
     m_QueueTarget = null;
 }
Пример #12
0
        public static bool DoLastTarget()
        {
            TargetInfo targ;

            if (Config.GetBool("SmartLastTarget") && Client.Instance.AllowBit(FeatureBit.SmartLT))
            {
                if (m_AllowGround && m_LastGroundTarg != null)
                {
                    targ = m_LastGroundTarg;
                }
                else if (m_CurFlags == 1)
                {
                    targ = m_LastHarmTarg;
                }
                else if (m_CurFlags == 2)
                {
                    targ = m_LastBeneTarg;
                }
                else
                {
                    targ = m_LastTarget;
                }

                if (targ == null)
                {
                    targ = m_LastTarget;
                }
            }
            else
            {
                if (m_AllowGround && m_LastGroundTarg != null)
                {
                    targ = m_LastGroundTarg;
                }
                else
                {
                    targ = m_LastTarget;
                }
            }

            if (targ == null)
            {
                return(false);
            }

            Point3D pos = Point3D.Zero;

            if (targ.Serial.IsMobile)
            {
                Mobile m = World.FindMobile(targ.Serial);
                if (m != null)
                {
                    pos = m.Position;

                    targ.X = pos.X;
                    targ.Y = pos.Y;
                    targ.Z = pos.Z;
                }
                else
                {
                    pos = Point3D.Zero;
                }
            }
            else if (targ.Serial.IsItem)
            {
                Item i = World.FindItem(targ.Serial);
                if (i != null)
                {
                    pos = i.GetWorldPosition();

                    targ.X = i.Position.X;
                    targ.Y = i.Position.Y;
                    targ.Z = i.Position.Z;
                }
                else
                {
                    pos    = Point3D.Zero;
                    targ.X = targ.Y = targ.Z = 0;
                }
            }
            else
            {
                if (!m_AllowGround && (targ.Serial == Serial.Zero || targ.Serial >= 0x80000000))
                {
                    World.Player.SendMessage(MsgLevel.Warning, LocString.LTGround);
                    return(false);
                }
                else
                {
                    pos = new Point3D(targ.X, targ.Y, targ.Z);
                }
            }

            if (Config.GetBool("RangeCheckLT") && Client.Instance.AllowBit(FeatureBit.RangeCheckLT) &&
                (pos == Point3D.Zero || !Utility.InRange(World.Player.Position, pos, Config.GetInt("LTRange"))))
            {
                if (Config.GetBool("QueueTargets"))
                {
                    m_QueueTarget = LastTargetAction;
                }
                World.Player.SendMessage(MsgLevel.Warning, LocString.LTOutOfRange);
                return(false);
            }

            if (CheckHealPoisonTarg(m_CurrentID, targ.Serial))
            {
                return(false);
            }

            CancelClientTarget();
            m_HasTarget = false;

            targ.TargID = m_CurrentID;

            if (m_Intercept)
            {
                OneTimeResponse(targ);
            }
            else
            {
                Client.Instance.SendToServer(new TargetResponse(targ));
            }
            return(true);
        }
 public FleetNeedCombatAssistEventArgs(ILogging logging, Int64 sendingFleetMemberId, int solarSystemId, QueueTarget target) :
     base(logging, sendingFleetMemberId, solarSystemId)
 {
     ObjectName = "NeedAssistEventArgs";
     Target     = target;
 }
Пример #14
0
 public FleetNeedAssistEventArgs(Int64 sendingFleetMemberID, int solarSystemID, QueueTarget target) :
     base(sendingFleetMemberID, solarSystemID)
 {
     ObjectName = "NeedAssistEventArgs";
     Target     = target;
 }
Пример #15
0
 internal static void ClearQueue()
 {
     m_QueueTarget = null;
 }
Пример #16
0
        internal static bool DoAutoTarget()
        {
            TargetInfo targ;

            targ = m_AutoTarget;

            if (targ == null)
            {
                return(false);
            }

            Point3D pos;

            if (targ.Serial.IsMobile)
            {
                Mobile m = World.FindMobile(targ.Serial);
                if (m != null)
                {
                    pos = m.Position;

                    targ.X = pos.X;
                    targ.Y = pos.Y;
                    targ.Z = pos.Z;
                }
                else
                {
                    pos = Point3D.Zero;
                }
            }
            else if (targ.Serial.IsItem)
            {
                Item i = World.FindItem(targ.Serial);
                if (i != null)
                {
                    pos = i.GetWorldPosition();

                    targ.X = i.Position.X;
                    targ.Y = i.Position.Y;
                    targ.Z = i.Position.Z;
                }
                else
                {
                    pos    = Point3D.Zero;
                    targ.X = targ.Y = targ.Z = 0;
                }
            }
            else
            {
                if (!m_AllowGround && (targ.Serial == Serial.Zero || targ.Serial >= 0x80000000))
                {
                    World.Player.SendMessage(MsgLevel.Warning, LocString.LTGround);
                    return(false);
                }
                else
                {
                    pos = new Point3D(targ.X, targ.Y, targ.Z);
                }
            }

            if (RazorEnhanced.Settings.General.ReadBool("RangeCheckLT") && (pos == Point3D.Zero || !Utility.InRange(World.Player.Position, pos, RazorEnhanced.Settings.General.ReadInt("LTRange"))))
            {
                if (RazorEnhanced.Settings.General.ReadBool("QueueTargets"))
                {
                    m_QueueTarget = AutoTargetAction;
                }
                World.Player.SendMessage(MsgLevel.Warning, LocString.LTOutOfRange);
                return(false);
            }

            if (CheckHealPoisonTarg(m_CurrentID, targ.Serial))
            {
                return(false);
            }

            CancelClientTarget(false);
            m_HasTarget = false;

            targ.TargID = m_CurrentID;

            if (m_Intercept)
            {
                OneTimeResponse(targ);
            }
            else
            {
                Assistant.Client.Instance.SendToServer(new TargetResponse(targ));
            }
            return(true);
        }
Пример #17
0
 internal static void CancelAutoTarget()
 {
     m_AutoTarget  = null;
     m_QueueTarget = null;
 }
Пример #18
0
 public static void ClearQueue()
 {
     m_QueueTarget = null;
 }
Пример #19
0
        public static bool DoLastTarget()
        {
            TargetInfo targ;
            if ( Config.GetBool( "SmartLastTarget" ) && ClientCommunication.AllowBit( FeatureBit.SmartLT ) )
            {
                if ( m_AllowGround && m_LastGroundTarg != null )
                    targ = m_LastGroundTarg;
                else if ( m_CurFlags == 1 )
                    targ = m_LastHarmTarg;
                else if ( m_CurFlags == 2 )
                    targ = m_LastBeneTarg;
                else
                    targ = m_LastTarget;

                if ( targ == null )
                    targ = m_LastTarget;
            }
            else
            {
                if ( m_AllowGround && m_LastGroundTarg != null )
                    targ = m_LastGroundTarg;
                else
                    targ = m_LastTarget;
            }

            if ( targ == null )
                return false;

            Point3D pos = Point3D.Zero;
            if ( targ.Serial.IsMobile )
            {
                Mobile m = World.FindMobile( targ.Serial );
                if ( m != null )
                {
                    pos = m.Position;

                    targ.X = pos.X;
                    targ.Y = pos.Y;
                    targ.Z = pos.Z;
                }
                else
                {
                    pos = Point3D.Zero;
                }
            }
            else if ( targ.Serial.IsItem )
            {
                Item i = World.FindItem( targ.Serial );
                if ( i != null )
                {
                    pos = i.GetWorldPosition();

                    targ.X = i.Position.X;
                    targ.Y = i.Position.Y;
                    targ.Z = i.Position.Z;
                }
                else
                {
                    pos = Point3D.Zero;
                    targ.X = targ.Y = targ.Z = 0;
                }
            }
            else
            {
                if ( !m_AllowGround && ( targ.Serial == Serial.Zero || targ.Serial >= 0x80000000 ) )
                {
                    World.Player.SendMessage( MsgLevel.Warning, LocString.LTGround );
                    return false;
                }
                else
                {
                    pos = new Point3D( targ.X, targ.Y, targ.Z );
                }
            }

            if ( Config.GetBool( "RangeCheckLT" ) && ClientCommunication.AllowBit( FeatureBit.RangeCheckLT ) && ( pos == Point3D.Zero || !Utility.InRange( World.Player.Position, pos, Config.GetInt( "LTRange" ) ) ) )
            {
                if ( Config.GetBool( "QueueTargets" ) )
                    m_QueueTarget = LastTargetAction;
                World.Player.SendMessage( MsgLevel.Warning, LocString.LTOutOfRange );
                return false;
            }

            if ( CheckHealPoisonTarg( m_CurrentID, targ.Serial ) )
                return false;

            CancelClientTarget();
            m_HasTarget = false;

            targ.TargID = m_CurrentID;

            if ( m_Intercept )
                OneTimeResponse( targ );
            else
                ClientCommunication.SendToServer( new TargetResponse( targ ) );
            return true;
        }
Пример #20
0
        public static void TargetSelf( bool forceQ )
        {
            if ( World.Player == null )
                return;

            //if ( Macros.MacroManager.AcceptActions )
            //	MacroManager.Action( new TargetSelfAction() );

            if ( m_HasTarget )
            {
                if ( !DoTargetSelf() )
                    ResendTarget();
            }
            else if ( forceQ || Config.GetBool( "QueueTargets" ) )
            {
                if ( !forceQ )
                    World.Player.OverheadMessage( LocString.QueuedTS );
                m_QueueTarget = TargetSelfAction;
            }
        }
Пример #21
0
        public static void LastTarget( bool forceQ )
        {
            //if ( Macros.MacroManager.AcceptActions )
            //	MacroManager.Action( new LastTargetAction() );

            if ( m_HasTarget )
            {
                if ( !DoLastTarget() )
                    ResendTarget();
            }
            else if ( forceQ || Config.GetBool( "QueueTargets" ) )
            {
                if ( !forceQ )
                    World.Player.OverheadMessage( LocString.QueuedLT );
                m_QueueTarget = LastTargetAction;
            }
        }