Jump to content

Change target on a during grind


Pudge
 Share

Recommended Posts

Hello to all who care, I think that a bot is very easy to detect when it grinds mobs. If an enemy player attacks the bot, until the bot kills all the mobs he fought before the player attacks him, he will not attack the player. I began to search on the forum, but did not find anything similar on this topic.

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;
        ChangeTargetSettings.Load();
        wManager.Events.FightEvents.OnFightLoop += TargetSwitcher;
        Logging.Write("[ChangeTarget2] Started.");
    }

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

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



    private void TargetSwitcher(WoWUnit woWPlayer, System.ComponentModel.CancelEventArgs cancelable)
    {
        while (_isLaunched)
        {
            WoWPlayer player = ObjectManager.GetNearestWoWPlayer(ObjectManager.GetObjectWoWPlayer());
            if (!player.IsAlive || player.Faction == ObjectManager.Me.Faction || player.IsFlying || player.IsMyTarget)
                return;
            if (player != null && player.IsValid && player.InCombatWithMe)
            {
                //if(ObjectManager.Target.Type != WoWObjectType.Player)
                //Fight.StopFight();
                Lua.LuaDoString("TargetNearestEnemyPlayer();");
                //Interact.InteractGameObject(player.GetBaseAddress, false);
                cancelable.Cancel = true;
                //Fight.StartFight(true, true, false, true);
                //FightBG.StartFight(player.Guid);
                var m = Fight.StartFight(player.Guid, false);
            }
        }
    }
}
    public class ChangeTargetSettings : Settings
{
    public ChangeTargetSettings()
    {

    }

    public static ChangeTargetSettings CurrentSetting { get; set; }

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

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

}

I made a plugin, but it does not work correctly. The plugin tries to start a fight with a player who attacked everything, but the fight with mobs does not stop, and the bot turns either towards the player or tries to fight with mobs. Is there any way to stop attacking mobs and focus on the bot attacking player?

Link to comment
Share on other sites

Hi,

No teested but you can try :

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;
        ChangeTargetSettings.Load();
        wManager.Events.FightEvents.OnFightLoop += TargetSwitcher;
        Logging.Write("[ChangeTarget2] Started.");
    }

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

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



    private void TargetSwitcher(WoWUnit woWPlayer, System.ComponentModel.CancelEventArgs cancelable)
    {
        while (_isLaunched)
        {
            WoWPlayer player = ObjectManager.GetNearestWoWPlayer(ObjectManager.GetObjectWoWPlayer());
            if (player == null || !player.IsValid || !player.IsAlive || player.Faction == ObjectManager.Me.Faction || player.IsFlying || player.IsMyTarget || woWPlayer.Guid == player.Guid)
                return;
            if (player.InCombatWithMe) // you can also try to use only player.IsTargetingMe
            {
                //if(ObjectManager.Target.Type != WoWObjectType.Player)
                //Fight.StopFight();
                //Lua.LuaDoString("TargetNearestEnemyPlayer();");
                //Interact.InteractGameObject(player.GetBaseAddress, false);
                cancelable.Cancel = true;
                //Fight.StartFight(true, true, false, true);
                //FightBG.StartFight(player.Guid);
                var m = Fight.StartFight(player.Guid, false);
            }
        }
    }
}
public class ChangeTargetSettings : Settings
{
    public ChangeTargetSettings()
    {

    }

    public static ChangeTargetSettings CurrentSetting { get; set; }

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

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

}

 

Link to comment
Share on other sites

1 hour ago, Droidz said:

Hi,

No teested but you can try :

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;
        ChangeTargetSettings.Load();
        wManager.Events.FightEvents.OnFightLoop += TargetSwitcher;
        Logging.Write("[ChangeTarget2] Started.");
    }

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

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



    private void TargetSwitcher(WoWUnit woWPlayer, System.ComponentModel.CancelEventArgs cancelable)
    {
        while (_isLaunched)
        {
            WoWPlayer player = ObjectManager.GetNearestWoWPlayer(ObjectManager.GetObjectWoWPlayer());
            if (player == null || !player.IsValid || !player.IsAlive || player.Faction == ObjectManager.Me.Faction || player.IsFlying || player.IsMyTarget || woWPlayer.Guid == player.Guid)
                return;
            if (player.InCombatWithMe) // you can also try to use only player.IsTargetingMe
            {
                //if(ObjectManager.Target.Type != WoWObjectType.Player)
                //Fight.StopFight();
                //Lua.LuaDoString("TargetNearestEnemyPlayer();");
                //Interact.InteractGameObject(player.GetBaseAddress, false);
                cancelable.Cancel = true;
                //Fight.StartFight(true, true, false, true);
                //FightBG.StartFight(player.Guid);
                var m = Fight.StartFight(player.Guid, false);
            }
        }
    }
}
public class ChangeTargetSettings : Settings
{
    public ChangeTargetSettings()
    {

    }

    public static ChangeTargetSettings CurrentSetting { get; set; }

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

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

}

 

In your version, he stops attacking mobs, but does not take the attacking player in the target, he just stands and looks towards the player

if add 

Lua.LuaDoString("TargetNearestEnemyPlayer();");

Behaves in the way I described when I posted the code (constantly changing the target from one to another)

Link to comment
Share on other sites

  • 2 weeks later...

still can't do something working

 

can anyone say why he cannot start a fight with a player?

A few more tests and here I understand that he still starts the battle, but some trait is only close, although range in my FС = 35

Link to comment
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.

 Share

×
×
  • Create New...