Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

MultiTarget Rotation C# Trouble

Featured Replies

Hey guys been trying to figure out this Multi Target rotation but I cant figure it out!

 

I need help because my attempt failed but I will link it so other learn from my mistakes. THIS METHOD IS BROKEN :b

 

I need a method that does such: Detect if there is more then 1 mob aggroed to me and or my pet which I believe ObjectManager.GetNumberAttackPlayer() > 1 does that. The method needs have the pet attack each target that is attacking me to try and get aggro. Then I just need to cycle through the aggroed units casting my warlock dots on each one until each target is dead then if all of my dots are on each target then focus the target with the least amount of health, rinse and repeat. I plan on calling this method from my CombatRotation method unless there is a better way. All are welcome to help, thanks!

GUYS I SERIOUSLY NEED YOUR HELP (: @Droidz , @iMod 

 

 private WoWUnit target;

internal void MultiTargetRotation()
    {
        if (ObjectManager.GetNumberAttackPlayer() > 1)
        {
            var UnitToAttack = ObjectManager.GetUnitAttackPlayer().FirstOrDefault();
            if (UnitToAttack != null)
            {
                target = UnitToAttack;
                Lua.LuaDoString("PetAttack();");
                Logging.Write("PET ATTACKING");

            }
            
            //IF ALL THE MOBS ARE ATTACKING THE PET FOCUS THE LOWER HP ONE
            else
            {
                double LowerHP = ObjectManager.GetUnitAttackPlayer().Min(unit => unit.HealthPercent);
                var LowerHPUnit =
                    ObjectManager.GetUnitAttackPlayer().SingleOrDefault(unit => unit.HealthPercent == LowerHP);

                if (LowerHPUnit != null && LowerHPUnit.Guid != target.Guid)
                {
                    Logging.Write("WHATS GOING ON");
                    target = LowerHPUnit;

                }
                {

                }
            }
        }
    }

 

No tested but use code like

    internal void MultiTargetRotation()
    {
        var unitsAffectingMyCombat = ObjectManager.GetUnitAttackPlayer();

        if (unitsAffectingMyCombat.Count <= 0)
            return;

        var unitsAttackMe = unitsAffectingMyCombat.Where(u => u != null && u.IsValid && u.IsTargetingMe).ToList();

        if (unitsAttackMe.Count > 1)
        {
            var unitToAttack = unitsAttackMe.FirstOrDefault(u => u != null && u.IsValid && !u.IsMyPetTarget);
            if (unitToAttack != null && unitToAttack.IsValid && unitToAttack.IsAlive)
            {
                if (!unitToAttack.IsMyTarget)
                    Interact.InteractGameObject(unitToAttack.GetBaseAddress, !ObjectManager.Me.GetMove);
                if (unitToAttack.IsMyTarget)
                    Lua.LuaDoString("PetAttack();");
                Logging.Write("PET ATTACKING: " + unitToAttack);
            }
        }
        //IF ALL THE MOBS ARE ATTACKING THE PET FOCUS THE LOWER HP ONE
        else
        {
            var unitsAttackPet = unitsAffectingMyCombat.Where(u => u != null && u.IsValid && u.IsTargetingMyPet).ToList();
            var lowerHpUnit = unitsAttackPet.OrderBy(unit => unit.HealthPercent).FirstOrDefault();
            if (lowerHpUnit != null && lowerHpUnit.IsValid && lowerHpUnit.IsAlive && !lowerHpUnit.IsMyPetTarget)
            {
                if (!lowerHpUnit.IsMyTarget)
                    Interact.InteractGameObject(lowerHpUnit.GetBaseAddress, !ObjectManager.Me.GetMove);
                if (lowerHpUnit.IsMyTarget)
                    Lua.LuaDoString("PetAttack();");
                Logging.Write("PET ATTACKING LOWER HP: " + lowerHpUnit);
            }
        }
    }

 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.