Esempio n. 1
0
        public static void Target(object obj, bool checkRange = false, bool useQueue = false)
        {
            int serial = AliasCommands.ResolveSerial(obj);

            if (serial == 0)
            {
                return;
            }

            if (checkRange && UOMath.IsMobile(serial) && Engine.TargetExists)
            {
                Mobile mobile = Engine.Mobiles.GetMobile(serial);

                if (mobile != null)
                {
                    if (mobile.Distance > Options.CurrentOptions.RangeCheckLastTargetAmount)
                    {
                        UOC.SystemMessage(Strings.Target_out_of_range__try_again___);
                        UOC.ResendTargetToClient();
                        return;
                    }
                }
                else
                {
                    UOC.SystemMessage(Strings.Target_out_of_range__try_again___);
                    UOC.ResendTargetToClient();
                    return;
                }
            }

            if (Options.CurrentOptions.PreventTargetingInnocentsInGuardzone && Engine.TargetExists)
            {
                Mobile mobile = Engine.Mobiles.GetMobile(serial);

                if (mobile != null && mobile.Notoriety == Notoriety.Innocent &&
                    mobile.Serial != Engine.Player?.Serial && Engine.TargetFlags == TargetFlags.Harmful &&
                    mobile.GetRegion().Attributes.HasFlag(RegionAttributes.Guarded))
                {
                    UOC.SystemMessage(Strings.Target_blocked____try_again___);
                    UOC.ResendTargetToClient();

                    return;
                }
            }

            if (useQueue && !Engine.TargetExists)
            {
                MsgCommands.HeadMsg(Strings.Target_Queued, Engine.Player?.Serial);
                Engine.LastTargetQueue.Enqueue(new TargetQueueObject {
                    Object = obj
                });
                return;
            }

            Engine.SendPacketToServer(new Target(TargetTypeEnum.Object, -1, TargetFlags.None, serial, -1, -1, -1, 0,
                                                 true));
            Engine.TargetExists = false;
        }
Esempio n. 2
0
        public static void Target(object obj, bool checkRange = false, bool useQueue = false)
        {
            int serial = AliasCommands.ResolveSerial(obj);

            if (serial == 0)
            {
                return;
            }

            if (checkRange && UOMath.IsMobile(serial))
            {
                Mobile mobile = Engine.Mobiles.GetMobile(serial);

                if (mobile != null)
                {
                    if (mobile.Distance > Options.CurrentOptions.RangeCheckLastTargetAmount)
                    {
                        UOC.SystemMessage(Strings.Target_out_of_range__try_again___);
                        UOC.ResendTargetToClient();
                        return;
                    }
                }
                else
                {
                    UOC.SystemMessage(Strings.Target_out_of_range__try_again___);
                    UOC.ResendTargetToClient();
                    return;
                }
            }

            if (useQueue && !Engine.TargetExists)
            {
                MsgCommands.HeadMsg(Strings.Target_Queued, Engine.Player?.Serial);
                Engine.LastTargetQueue.Enqueue(serial);
            }
            else
            {
                Engine.SendPacketToServer(new Target(TargetType.Object, -1, TargetFlags.None, serial, -1, -1, -1, 0,
                                                     true));
            }
        }