Jump to content

Are there a way to 'tag' multiple mobs at a time, even though they are in combat?


Recommended Posts

I am having a usecase where i need to simply tag the mob, and thats all. Theres a lot of mobs and I need to tag them. They are already in combat and I dont need to kill them. Are the anyway to do this?

Hello, look https://wrobot.eu/files/file/414-multi-pull/

I added an option to be able to attack mobs already in combat :

using System;
using System.ComponentModel;
using System.Configuration;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using robotManager.Helpful;
using wManager;
using wManager.Plugin;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;

public class Main : IPlugin
{
    private bool _isLaunched;

    public void Initialize()
    {
        _isLaunched = true;
        MultiPullSettings.Load();
        wManager.Events.FightEvents.OnFightLoop += FightEventsOnOnFightLoop;
        Logging.Write("[MultiPull2] Started.");
    }

    public void Dispose()
    {
        try
        {
            wManager.Events.FightEvents.OnFightLoop -= FightEventsOnOnFightLoop;
        }
        catch {}
        _isLaunched = false;
        Logging.Write("[MultiPull2] Stoped.");
    }

    public void Settings()
    {
        MultiPullSettings.Load();
        MultiPullSettings.CurrentSetting.ToForm();
        MultiPullSettings.CurrentSetting.Save();
        Logging.Write("[MultiPull2] Settings saved.");
    }



    private void FightEventsOnOnFightLoop(WoWUnit woWUnit, CancelEventArgs cancelable)
    {
        if (_isLaunched &&
            Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause &&
            Fight.InFight &&
            ObjectManager.Target.IsValid &&
            ObjectManager.Target.IsTargetingMeOrMyPetOrPartyMember &&
            ObjectManager.Me.HealthPercent >= MultiPullSettings.CurrentSetting.MinHealth &&
            ObjectManager.GetNumberAttackPlayer() < MultiPullSettings.CurrentSetting.MobMax)
        {
            var mobs = new List<WoWUnit>();
            if (MultiPullSettings.CurrentSetting.AllFactions)
            {
                mobs.AddRange(ObjectManager.GetWoWUnitAttackables(MultiPullSettings.CurrentSetting.PullRange));
            }
            else
            {
                mobs.AddRange(ObjectManager.GetWoWUnitByEntry(MultiPullSettings.CurrentSetting.MobsList));
            }

            var listGuidUnitAttackPlayer = ObjectManager.GetUnitAttackPlayer().Select(m => m.Guid).ToArray();
            for (int i = mobs.Count - 1; i >= 0; i--)
            {
                if (!mobs[i].IsValid ||
                    !mobs[i].IsAlive ||
                    ((MultiPullSettings.CurrentSetting.CanAttackMobInCombat && mobs[i].IsTargetingMeOrMyPet) || (!MultiPullSettings.CurrentSetting.CanAttackMobInCombat && mobs[i].Target.IsNotZero())) ||
                    listGuidUnitAttackPlayer.Contains(mobs[i].Guid) ||
                    mobs[i].Guid == ObjectManager.Pet.Guid ||
                    MultiPullSettings.CurrentSetting.BListMobs.Contains(mobs[i].Entry) ||
                    mobs[i].GetDistance > MultiPullSettings.CurrentSetting.PullRange ||
                    wManagerSetting.IsBlackListedAllConditions(mobs[i]) ||
                    mobs[i].Level < MultiPullSettings.CurrentSetting.MinTargetLevel ||
                    mobs[i].Level > MultiPullSettings.CurrentSetting.MaxTargetLevel
                )
                {
                    mobs.RemoveAt(i);
                }
            }

            var unit = ObjectManager.GetNearestWoWUnit(mobs);

            if (unit.IsValid)
            {
                Logging.WriteDebug(string.Format("[MultiPull2] Pull {0} (distance: {1}).", unit.Name, unit.GetDistance));
                if (ObjectManager.Target.IsValid) Lua.LuaDoString("ClearTarget();");
                cancelable.Cancel = true;
                var m = Fight.StartFight(unit.Guid, false);
                //if (m.IsNotZero()) wManagerSetting.AddBlackList(m, 1000 * 50);
            }
        }
    }
}

public class MultiPullSettings : Settings
{
    public MultiPullSettings()
    {
        MobMax = 3;
        PullRange = 35;
        MinHealth = 65;
        MinTargetLevel = 2;
        MaxTargetLevel = 110;
        AllFactions = true;
        MobsList = new List<int>();
        BListMobs = new List<int>();
    }

    public static MultiPullSettings CurrentSetting { get; set; }

    public bool Save()
    {
        try
        {
            return Save(AdviserFilePathAndName("MultiPull", ObjectManager.Me.Name + "." + Usefuls.RealmName));
        }
        catch (Exception e)
        {
            Logging.WriteError("MultiPullSettings > Save(): " + e);
            return false;
        }
    }

    public static bool Load()
    {
        try
        {
            if (File.Exists(AdviserFilePathAndName("MultiPull", ObjectManager.Me.Name + "." + Usefuls.RealmName)))
            {
                CurrentSetting =
                    Load<MultiPullSettings>(AdviserFilePathAndName("MultiPull",
                        ObjectManager.Me.Name + "." + Usefuls.RealmName));
                return true;
            }
            CurrentSetting = new MultiPullSettings();
        }
        catch (Exception e)
        {
            Logging.WriteError("MultiPullSettings > Load(): " + e);
        }
        return false;
    }

    [Setting]
    [Category("Settings")]
    [DisplayName("Max Mobs")]
    [Description("Max number of mobs to fight at the same Time")]
    public int MobMax { get; set; }

    [Setting]
    [Category("Settings")]
    [DisplayName("Range")]
    [Description("Range for Pull")]
    public int PullRange { get; set; }

    [Setting]
    [Category("Settings")]
    [DisplayName("Min health")]
    [Description("Stop pulling if health smaller than %")]
    public int MinHealth { get; set; }

    [Setting]
    [Category("Settings")]
    [DisplayName("Min target level")]
    [Description("Minimum target level")]
    public int MinTargetLevel { get; set; }

    [Setting]
    [Category("Settings")]
    [DisplayName("Max target level")]
    [Description("Maximum target level")]
    public int MaxTargetLevel { get; set; }

    [Setting]
    [Category("Settings")]
    [DisplayName("Pulls all mobs")]
    [Description("Pulls all mobs type")]
    public bool AllFactions { get; set; }

    [Setting]
    [Category("Settings")]
    [DisplayName("Mobs list")]
    [Description("List of mobs at pull (to use this list don't forget to deactivate option 'Pulls all mobs') (you can found entry id of mobs in tab 'Tools' with 'Dev tools')")]
    public List<int> MobsList { get; set; }

    [Setting]
    [Category("Settings")]
    [DisplayName("Blacklist mobs")]
    [Description("List of mobs at ignore (you can found entry id of mobs in tab 'Tools' with 'Dev tools')")]
    public List<int> BListMobs { get; set; }

    [Setting]
    [Category("Settings")]
    [DisplayName("Can attack mob already in combat")]
    [Description("Can attack mob already in combat")]
    public bool CanAttackMobInCombat { get; set; } = true;
}

(no tested)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...