Browse Source

OK FrostfangSea and some other huge exceptions for NPCs, restrict the attackable flag to bot, client and their pets

Emagi 4 months ago
parent
commit
72a43fdbb4
1 changed files with 4 additions and 5 deletions
  1. 4 5
      EQ2/source/WorldServer/Combat.cpp

+ 4 - 5
EQ2/source/WorldServer/Combat.cpp

@@ -96,11 +96,6 @@ bool Entity::AttackAllowed(Entity* target, float distance, bool range_attack) {
 		LogWrite(COMBAT__DEBUG, 3, "AttackAllowed", "Failed to attack: no target, mezzed, stunned or dazed");
 		return false;
 	}
-	
-	if(!target->IsPlayer() && !target->GetAttackable()) {
-		return false;
-	}
-
 	if (IsPlayer())
 		client = ((Player*)this)->GetClient();
 
@@ -111,6 +106,10 @@ bool Entity::AttackAllowed(Entity* target, float distance, bool range_attack) {
 			target = ((NPC*)target)->GetOwner();
 	}
 
+	if((IsBot() || (client || (attacker && (attacker->IsPlayer() || attacker->IsBot())))) && !target->IsPlayer() && !target->GetAttackable()) {
+		return false;
+	}
+
 	if (attacker == target) {
 		LogWrite(COMBAT__DEBUG, 3, "AttackAllowed", "Failed to attack: attacker tried to attack himself or his pet.");
 		return false;