Ver Fonte

BETA: Moving onNpcHate notification after validating attackable conditions to prevent from attacking invisible GMs and stuff like that.

Rumen Nikiforov há 11 anos atrás
pai
commit
4f7bddc690

+ 18 - 18
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2AttackableAI.java

@@ -484,31 +484,31 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 					}
 				}
 				
-				if (obj.isPlayable())
+				// TODO: The AI Script ought to handle aggro behaviors in onSee. Once implemented, aggro behaviors ought
+				// to be removed from here. (Fulminus)
+				// For each L2Character check if the target is autoattackable
+				if (autoAttackCondition(target)) // check aggression
 				{
-					final List<Quest> quests = getActiveChar().getTemplate().getEventQuests(QuestEventType.ON_NPC_HATE);
-					if (quests != null)
+					if (target.isPlayable())
 					{
-						boolean breaking = false;
-						for (Quest q : quests)
+						final List<Quest> quests = getActiveChar().getTemplate().getEventQuests(QuestEventType.ON_NPC_HATE);
+						if (quests != null)
 						{
-							if (!q.onNpcHate(getActiveChar(), (L2Playable) obj))
+							boolean breaking = false;
+							for (Quest q : quests)
 							{
-								breaking = true;
+								if (!q.onNpcHate(getActiveChar(), (L2Playable) target))
+								{
+									breaking = true;
+								}
+							}
+							if (breaking)
+							{
+								continue;
 							}
-						}
-						if (breaking)
-						{
-							continue;
 						}
 					}
-				}
-				
-				// TODO: The AI Script ought to handle aggro behaviors in onSee. Once implemented, aggro behaviors ought
-				// to be removed from here. (Fulminus)
-				// For each L2Character check if the target is autoattackable
-				if (autoAttackCondition(target)) // check aggression
-				{
+					
 					// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
 					int hating = npc.getHating(target);