Browse Source

Fix for attackable ai aggression handling.
REQUIRED DP UPDATE, or server will be completely broken !

_DS_ 16 years ago
parent
commit
085792c2c9

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/ai/L2AttackableAI.java

@@ -466,7 +466,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 						
 						// Add the attacker to the L2Attackable _aggroList with 0 damage and 1 hate
 						if (hating == 0)
-							npc.addDamageHate(target, 0, 1);
+							npc.addDamageHate(target, 0, 0);
 					}
 				}
 			}

+ 15 - 26
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/L2Attackable.java

@@ -813,22 +813,25 @@ public class L2Attackable extends L2Npc
 		// Get the AggroInfo of the attacker L2Character from the _aggroList of the L2Attackable
 		AggroInfo ai = getAggroListRP().get(attacker);
 
-		// aggro ai created in L2attackableAI script if not overriden in other AI files
-		if (ai != null)
+		if (ai == null)
 		{
-			ai._hate += aggro;
-			ai._damage += damage;
+			ai = new AggroInfo(attacker);
+			getAggroListRP().put(attacker, ai);
+
+			ai._damage = 0;
+			ai._hate = 0;
 		}
-		else
+		ai._damage += damage;
+		ai._hate += aggro;
+
+		L2PcInstance targetPlayer = attacker.getActingPlayer();
+		if (targetPlayer != null && aggro == 0)
 		{
-			L2PcInstance targetPlayer = attacker.getActingPlayer();
-			if (targetPlayer != null)
-			{
-				if (getTemplate().getEventQuests(Quest.QuestEventType.ON_AGGRO_RANGE_ENTER) !=null)
-					for (Quest quest: getTemplate().getEventQuests(Quest.QuestEventType.ON_AGGRO_RANGE_ENTER))
-				quest.notifyAggroRangeEnter(this, targetPlayer, (attacker instanceof L2Summon));
-			}
+			if (getTemplate().getEventQuests(Quest.QuestEventType.ON_AGGRO_RANGE_ENTER) !=null)
+				for (Quest quest: getTemplate().getEventQuests(Quest.QuestEventType.ON_AGGRO_RANGE_ENTER))
+					quest.notifyAggroRangeEnter(this, targetPlayer, (attacker instanceof L2Summon));
 		}
+
 		// Set the intention to the L2Attackable to AI_INTENTION_ACTIVE
 		if (aggro > 0 && getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)
 			getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
@@ -2464,18 +2467,4 @@ public class L2Attackable extends L2Npc
 		if (hasAI())
 			getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(getSpawn().getLocx(), getSpawn().getLocy(), getSpawn().getLocz(), 0));
 	}
-	
-	public AggroInfo addToAggroList(L2Character character)
-	{
-		// Get the AggroInfo of the attacker L2Character from the _aggroList of the L2Attackable
-		AggroInfo ai = getAggroListRP().get(character);
-		if (ai == null)
-		{
-			ai = new AggroInfo(character);
-			ai._damage = 0;
-			ai._hate = 0;
-			getAggroListRP().put(character, ai);
-		}
-    	return ai;
-	}
 }