Prechádzať zdrojové kódy

BETA: Fixing NPEs caused by [5802] (Missing check if player has summon).
* Moving hasSummon() to L2Character from L2PcInstance.
* Note: Using OOP approach getSummon() is overridden in L2Summon.

Rumen Nikiforov 12 rokov pred
rodič
commit
9c675a5dfa

+ 8 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Character.java

@@ -2697,6 +2697,14 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
 		return null;
 	}
 	
+	/**
+	 * @return {@code true} if the player has a pet, {@code false} otherwise
+	 */
+	public boolean hasSummon()
+	{
+		return getSummon() != null;
+	}
+	
 	public final boolean isRooted()
 	{
 		return isAffected(EffectFlag.ROOTED);

+ 0 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -6553,14 +6553,6 @@ public final class L2PcInstance extends L2Playable
 		return _summon;
 	}
 	
-	/**
-	 * @return {@code true} if the player has a pet, {@code false} otherwise
-	 */
-	public boolean hasSummon()
-	{
-		return _summon != null;
-	}
-	
 	/**
 	 * @return the L2Decoy of the L2PcInstance or null.
 	 */

+ 3 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/effects/L2Effect.java

@@ -29,6 +29,7 @@ import com.l2jserver.gameserver.ThreadPoolManager;
 import com.l2jserver.gameserver.datatables.SkillTable;
 import com.l2jserver.gameserver.model.ChanceCondition;
 import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.actor.L2Summon;
 import com.l2jserver.gameserver.model.interfaces.IChanceSkillTrigger;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 import com.l2jserver.gameserver.model.skills.L2SkillType;
@@ -156,7 +157,8 @@ public abstract class L2Effect implements IChanceSkillTrigger
 		int temp = template.abnormalTime;
 		if (((_skill.getId() > 2277) && (_skill.getId() < 2286)) || ((_skill.getId() >= 2512) && (_skill.getId() <= 2514)))
 		{
-			if ((_effected != null) && (_effected.isServitor() || (_effected.isPlayer() && _effected.getSummon().isServitor())))
+			final L2Summon summon = _effected.getSummon();
+			if ((summon != null) && summon.isServitor())
 			{
 				temp /= 2;
 			}