Jump to content

Fighting with mob, attacked by player, bot keep going on mob


Artek
 Share

Recommended Posts

On 10/22/2020 at 2:57 AM, Artek said:

So today during grind player attacked me, bot instead of picking a player, was still attacking and chasing fleeing mob. Is there a way to make wrobot switch attacking player ?

You have to modify ur fightclass.

public void Initialize()
{        
	FightEvents.OnFightLoop += TargetSwitcher;
}

public void Dispose()
{        
	FightEvents.OnFightLoop -= TargetSwitcher;
}

private void TargetSwitcher(WoWUnit woWPlayer, System.ComponentModel.CancelEventArgs cancelable)
{	
    WoWPlayer player = ObjectManager.GetNearestWoWPlayer(ObjectManager.GetObjectWoWPlayer().Where(o => o.IsAttackable).ToList());
    if (player == null || !player.IsValid || !player.IsAlive || player.Faction == ObjectManager.Me.Faction || player.IsFlying || player.IsMyTarget || woWPlayer.Guid == player.Guid)
    	return;
    if (player.InCombatWithMe && ObjectManager.Target.Type != WoWObjectType.Player)
    {
       cancelable.Cancel = true;               
       Fight.StartFight(player.Guid, robotManager.Products.Products.ProductName != "WRotation", false);
    }  
}

 

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...