浏览代码

BETA: Misc Changes:
* Moving Shots recharge in onSpawn in case of npc respawn it will have the remaining shots from previous death.
* Reported by: Tryskell
* Fixing potential NPEs in FuncShare.

Rumen Nikiforov 12 年之前
父节点
当前提交
3ff7b93bf8

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2CharacterAI.java

@@ -708,12 +708,12 @@ public class L2CharacterAI extends AbstractAI
 			((L2Attackable) _accessor.getActor()).setisReturningToSpawnPoint(false);
 			((L2Attackable) _accessor.getActor()).setisReturningToSpawnPoint(false);
 		}
 		}
 		clientStoppedMoving();
 		clientStoppedMoving();
-
+		
 		if (_actor instanceof L2Npc)
 		if (_actor instanceof L2Npc)
 		{
 		{
 			L2Npc npc = (L2Npc) _actor;
 			L2Npc npc = (L2Npc) _actor;
 			WalkingManager.getInstance().onArrived(npc); // Walking Manager support
 			WalkingManager.getInstance().onArrived(npc); // Walking Manager support
-
+			
 			// Notify quest
 			// Notify quest
 			if (npc.getTemplate().getEventQuests(Quest.QuestEventType.ON_MOVE_FINISHED) != null)
 			if (npc.getTemplate().getEventQuests(Quest.QuestEventType.ON_MOVE_FINISHED) != null)
 			{
 			{

+ 4 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Npc.java

@@ -473,10 +473,6 @@ public class L2Npc extends L2Character
 		_currentCollisionHeight = getTemplate().getfCollisionHeight();
 		_currentCollisionHeight = getTemplate().getfCollisionHeight();
 		_currentCollisionRadius = getTemplate().getfCollisionRadius();
 		_currentCollisionRadius = getTemplate().getfCollisionRadius();
 		
 		
-		// initialize the "current" shots
-		_soulshotamount = getTemplate().getAIDataStatic().getSoulShot();
-		_spiritshotamount = getTemplate().getAIDataStatic().getSpiritShot();
-		
 		if (template == null)
 		if (template == null)
 		{
 		{
 			_log.severe("No template for Npc. Please check your datapack is setup correctly.");
 			_log.severe("No template for Npc. Please check your datapack is setup correctly.");
@@ -1434,6 +1430,10 @@ public class L2Npc extends L2Character
 	{
 	{
 		super.onSpawn();
 		super.onSpawn();
 		
 		
+		// Recharge shots
+		_soulshotamount = getTemplate().getAIDataStatic().getSoulShot();
+		_spiritshotamount = getTemplate().getAIDataStatic().getSpiritShot();
+		
 		if (getTemplate().getEventQuests(QuestEventType.ON_SPAWN) != null)
 		if (getTemplate().getEventQuests(QuestEventType.ON_SPAWN) != null)
 		{
 		{
 			for (Quest quest : getTemplate().getEventQuests(QuestEventType.ON_SPAWN))
 			for (Quest quest : getTemplate().getEventQuests(QuestEventType.ON_SPAWN))

+ 4 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncShare.java

@@ -14,6 +14,7 @@
  */
  */
 package com.l2jserver.gameserver.model.skills.funcs;
 package com.l2jserver.gameserver.model.skills.funcs;
 
 
+import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Summon;
 import com.l2jserver.gameserver.model.actor.L2Summon;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Env;
@@ -37,9 +38,10 @@ public class FuncShare extends Func
 	{
 	{
 		if ((cond == null) || cond.test(env))
 		if ((cond == null) || cond.test(env))
 		{
 		{
-			if (env.getCharacter().isServitor())
+			final L2Character ch = env.getCharacter();
+			if ((ch != null) && ch.isServitor())
 			{
 			{
-				final L2Summon summon = (L2Summon) env.getCharacter();
+				final L2Summon summon = (L2Summon) ch;
 				final L2PcInstance player = summon.getOwner();
 				final L2PcInstance player = summon.getOwner();
 				final double value = player.calcStat(stat, 0, null, null) * _lambda.calc(env);
 				final double value = player.calcStat(stat, 0, null, null) * _lambda.calc(env);
 				env.addValue(value);
 				env.addValue(value);