Răsfoiți Sursa

Player wasn't removed from _allplayers if crash happened during teleport. Additionally fixing one classcast and setting damage formulas to 0 if target invul.

Sami 17 ani în urmă
părinte
comite
734179e2d7

+ 7 - 5
L2_GameServer_T1/java/net/sf/l2j/gameserver/model/L2Object.java

@@ -203,15 +203,17 @@ public abstract class L2Object
         	}
         	if (itemId == 57 || itemId == 6353)
         	{
-        		QuestState qs = ((L2PcInstance) player).getQuestState("255_Tutorial");
-        		if(qs != null)
+        		QuestState qs = null;
+        		if (player instanceof L2Summon)
+        			qs = ((L2Summon)player).getOwner().getQuestState("255_Tutorial");
+        		else if (player instanceof L2PcInstance)
+        			qs = ((L2PcInstance)player).getQuestState("255_Tutorial");
+        		if (qs != null)
         			qs.getQuest().notifyEvent("CE"+itemId+"",null,(L2PcInstance)player);
         	}
         }
 
-
-        // this can synchronize on others instancies, so it's out of
-        // synchronized, to avoid deadlocks
+        // outside of synchronized to avoid deadlocks
         // Remove the L2ItemInstance from the world
         L2World.getInstance().removeVisibleObject(this, oldregion);
     }

+ 1 - 0
L2_GameServer_T1/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java

@@ -9887,6 +9887,7 @@ public final class L2PcInstance extends L2PlayableInstance
 
 		// Remove L2Object object from _allObjects of L2World
 		L2World.getInstance().removeObject(this);
+		L2World.getInstance().removeFromAllPlayers(this); // force remove in case of crash during teleport
 	}
 
 	private FishData _fish;

+ 3 - 0
L2_GameServer_T1/java/net/sf/l2j/gameserver/skills/Formulas.java

@@ -1085,6 +1085,7 @@ public final class Formulas
 	/** Calculate blow damage based on cAtk */
 	public double calcBlowDamage(L2Character attacker, L2Character target, L2Skill skill, boolean shld, boolean ss)
 	{
+		if (target.isInvul()) return 0;
 		double power = skill.getPower();
 		double damage = attacker.getPAtk(target);
 		double defence = target.getPDef(attacker);
@@ -1142,6 +1143,7 @@ public final class Formulas
 	public final double calcPhysDam(L2Character attacker, L2Character target, L2Skill skill,
 									boolean shld, boolean crit, boolean dual, boolean ss)
 	{
+		if (target.isInvul()) return 0;
 		if (attacker instanceof L2PcInstance)
 		{
 			L2PcInstance pcInst = (L2PcInstance)attacker;
@@ -1320,6 +1322,7 @@ public final class Formulas
 	public final double calcMagicDam(L2Character attacker, L2Character target, L2Skill skill,
 										boolean ss, boolean bss, boolean mcrit)
 	{
+		if (target.isInvul()) return 0;
 		if (attacker instanceof L2PcInstance)
 		{
 			L2PcInstance pcInst = (L2PcInstance)attacker;