View Single Post
  #9  
Old 01-08-2014, 02:30 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,589
Default

Sorry for resurrecting such an old thread, but some of this code was never added, as the issue is still around.

I don't seem to be able to find this bit of code anywhere in the mentioned files.

May I get some confirmation as to if this is the cause of the issue, and if adding these lines would fix it?
Code:
@@ -3594,7 +3594,8 @@ 
void Bot::AI_Process() 
{
	if(g) 
	{
		for(int counter = 0; counter < g->GroupCount(); counter++) 
		{
			if(g->members[counter]) 
			{
-				if(g->members[counter]->IsEngaged() && g->members[counter]->GetTarget()) {
+				if(g->members[counter]->IsEngaged() && g->members[counter]->GetTarget() &&
+					g->members[counter]->GetTarget() != this && this->IsAttackAllowed(g->members[counter]->GetTarget())) {
Code:
if(g)
{
	for(int counter = 0; counter < g->GroupCount(); counter++) 
	{
		if(g->members[counter]) 
		{
			Mob* tar = g->members[counter]->GetTarget();
			if(tar && tar->IsNPC() && tar->GetHateAmount(g->members[counter]) && IsAttackAllowed(g->members[counter]->GetTarget())) 
			{
				AddToHateList(tar, 1);
				if(HasPet())
					GetPet()->AddToHateList(tar, 1);
				break;
			}
		}
	}
}
IsGrouped(), IsAttackAllowed() wasn't added.
Code:
@@ -6364,8 +6365,10 @@ 
void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillType attack_skill, bool avoidable, int8 buffslot, bool iBuffTic)
{
+	if(this == from) { return; } // IsAttackAllowed() check below returns true for 'this = this'
+
 	// Aggro the bot's group members
-	if(IsGrouped())
+	if(IsGrouped() && IsAttackAllowed(from))
Code:
if(IsGrouped())
{
	Group *g = GetGroup();
	if(g)
	{
		for(int i=0; i<MAX_GROUP_MEMBERS; i++)
		{
			if(g->members[i] && g->members[i]->IsBot() && from && !g->members[i]->CheckAggro(from) && g->members[i]->IsAttackAllowed(from))
			{
				g->members[i]->AddToHateList(from, 1);
			}
		}
	}
}
Reply With Quote