Jump to content
This site uses cookies! Learn More

This site uses cookies!

By continuing to use this site, you agree to allow us to store cookies on your computer. :)

Stranger

Healing in BG

Recommended Posts

It was never implemented. You can write your own healing fightclasses in C# that will heal friends. If you want to follow friends around in combat

I suggest using C# code similar to this:

public void Initialize()
    {    
        FightEvents.OnFightLoop += FightEventsOnOnFightLoop;
        FightEvents.OnFightStart += FightEventsOnOnFightStart;
        
        Rotation();
    }

private void FightEventsOnOnFightStart(WoWUnit unit, CancelEventArgs cancelable)
    {
        if (!ObjectManager.GetObjectWoWPlayer()
            .Any(p => p.IsAlive && p.Reaction == Reaction.Friendly && p.Position.DistanceTo(unit.Position) <= 30) && !Me.HaveAnyDebuff("Idle", "Inactive"))
        {
            BlackList(unit);
            cancelable.Cancel = true;
            RunToHealTarget();
        }
    }

    private void BlackList(WoWUnit unit, uint seconds = 15)
    {
        wManagerSetting.AddBlackList(unit.Guid, (int) (seconds * 1000), true);
        ObjectManager.BlackListObjectManagerGuid.Add(unit.Guid);
        new Thread(() =>
        {
            Thread.Sleep((int) (seconds * 1000));
            ObjectManager.BlackListObjectManagerGuid.Remove(unit.Guid);
        }).Start();
    }

    private bool RunToHealTarget()
    {
        WoWUnit healTarget = ObjectManager.GetObjectWoWUnit()
            .Where(o => o.Guid != Me.Guid && o.IsAlive && o.Reaction == Reaction.Friendly && o.HealthPercent <= 80 &&
                        o.Type == WoWObjectType.Player && o.GetDistance <= 75)
            .OrderBy(o => o.GetDistance)
            .FirstOrDefault();

        if (healTarget != null && healTarget.GetDistance > 10 && !Me.IsCast)
        {
            Logging.WriteFight("healing target found - chasing it to heal");
            Me.Target = healTarget.Guid;
            if (GoToTask.ToPosition(healTarget.Position, 10f, false, context => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && Me.HealthPercent > 55))
            {
                MovementManager.StopMoveTo(false, 1500);
                return true;
            }
        }

        return false;
    }

private void FightEventsOnOnFightLoop(WoWUnit unit, CancelEventArgs cancelable)
    {
        //No friend to heal in range!
        WoWUnit friendInRange = ObjectManager.GetObjectWoWPlayer()
            .Where(p => p.Guid != Me.Guid && p.IsAlive && p.Reaction == Reaction.Friendly && p.HealthPercent <= 80 && p.GetDistance <= 35 && !TraceLine.TraceLineGo(p.Position))
            .OrderBy(p => p.GetDistance)
            .FirstOrDefault();
        
        if (friendInRange == null)
        {
            if (RunToHealTarget())
            {
                cancelable.Cancel = true;
            }
        }
        else
        {
            if (friendInRange?.GetDistance > 30 && !Me.IsCast)
            {
                Logging.WriteFight("Running closer to heal target");
                MovementManager.MoveTo(friendInRange);
                Thread.Sleep(2500);
            }
            MovementManager.StopMoveTo(false, 1000);
        }
    }

For a resto shaman (vanilla) example fightclass, you can check out the source code here:

 

Edited by Matenia

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...