Exemple #1
0
        private static void WorldEx_MobileUpdated(Serial serial)
        {
            if (serial != World.Player.Serial && serial != healSerial)
            {
                return;
            }
            if (IsHealing || World.Player.IsGhost || !World.Player.Visible)
            {
                return;
            }

            Mobile target;

            if (enabled && (World.Player.Hits < World.Player.HitsMax * 0.90 || World.Player.Poisoned))
            {
                IsHealing = !Bandages.Valid || Bandages.Enchanced ? ebs.Perform() : BandageSelf();
            }
            else if (healSerial.IsValid && (target = World.FindMobile(healSerial)) != null && target.Hits < target.HitsMax * 0.90 && Utility.Distance(target.Position, World.Player.Position) < 3 && Bandages.Valid)
            {
                prevQueue = Targeting.QueuedTarget;
                Targeting.CancelTarget();
                Targeting.QueuedTarget = () =>
                {
                    Targeting.Target(healSerial);
                    return(true);
                };
                Bandages.Use();
                IsHealing = true;
            }
        }
Exemple #2
0
 private static void OnServerTarget(PacketReader p, PacketHandlerEventArgs args)
 {
     if (prevQueue != null)
     {
         Targeting.QueuedTarget = prevQueue;
         prevQueue = null;
     }
 }
Exemple #3
0
        private static bool?Event_LocalizedMessage(Serial serial, ItemID graphic, byte type, ushort hue, ushort font, int num, string name, string args)
        {
            if (num != 500617)
            {
                return(null);
            }

            Item item = World.Player.Backpack.FindItem(0x2AFA) ?? World.Player.Backpack.FindItem(IsInstrument);

            if (item != null)
            {
                Targeting.QueueTarget queue = Targeting.QueuedTarget;
                Targeting.CancelTarget();
                Targeting.QueuedTarget = () =>
                {
                    Targeting.Target(item);
                    Timer.DelayedCallback(TimeSpan.FromMilliseconds(10), () => Targeting.QueuedTarget = queue).Start();
                    return(true);
                };
            }
            return(null);
        }
Exemple #4
0
        private static bool BandageSelf()
        {
            if (targetTimer != null && targetTimer.Running)
            {
                return(false);
            }

            if (Targeting.HasTarget)
            {
                targetTimer = Timer.DelayedCallback(TimeSpan.FromSeconds(5), OnTargetTimer);
                targetTimer.Start();
                return(false);
            }

            if (!Bandages.Valid)
            {
                return(false);
            }
            prevQueue = Targeting.QueuedTarget;
            Targeting.CancelTarget();
            Targeting.QueuedTarget = Targeting.DoTargetSelf;
            Bandages.Use();
            return(true);
        }