Răsfoiți Sursa

BETA: Misc Fixes:
* L2Character:
* Fixing HP Update when equip/un-equip item which gives/takes HP.
* L2World:
* Log cleanup.
* if (object instanceof L2PcInstance) => if (object.isPlayer())
* Cleanup comments.
* Stats:
* Comments typo fixes.
* FuncTemplate:
* Catching all exceptions at once instead catching every possible exception separately.

Rumen Nikiforov 12 ani în urmă
părinte
comite
51e4926cb5

+ 15 - 15
L2J_Server_BETA/java/com/l2jserver/gameserver/model/L2World.java

@@ -112,10 +112,10 @@ public final class L2World
 	{
 		if (_allObjects.containsKey(object.getObjectId()))
 		{
-			_log.warning("[L2World] Current object: " + object + " already exist in OID map!");
-			_log.log(Level.WARNING, "New object: " + StringUtil.getTraceString(Thread.currentThread().getStackTrace()));
-			_log.warning("[L2World] Previous object: " + _allObjects.get(object.getObjectId()) + " already exist in OID map!");
-			_log.log(Level.WARNING, "Previous: " + _allObjectsDebug.get(object.getObjectId()));
+			_log.log(Level.WARNING, getClass().getSimpleName() + ": Current object: " + object + " already exist in OID map!");
+			_log.log(Level.WARNING, StringUtil.getTraceString(Thread.currentThread().getStackTrace()));
+			_log.log(Level.WARNING, getClass().getSimpleName() + ": Previous object: " + _allObjects.get(object.getObjectId()) + " already exist in OID map!");
+			_log.log(Level.WARNING, _allObjectsDebug.get(object.getObjectId()));
 			_log.log(Level.WARNING, "---------------------- End ---------------------");
 			return;
 		}
@@ -130,7 +130,7 @@ public final class L2World
 	 */
 	public void removeObject(L2Object object)
 	{
-		_allObjects.remove(object.getObjectId()); // suggestion by whatev
+		_allObjects.remove(object.getObjectId());
 		_allObjectsDebug.remove(object.getObjectId());
 	}
 	
@@ -140,7 +140,7 @@ public final class L2World
 		{
 			if (o != null)
 			{
-				_allObjects.remove(o.getObjectId()); // suggestion by whatev
+				_allObjects.remove(o.getObjectId());
 				_allObjectsDebug.remove(o.getObjectId());
 			}
 		}
@@ -150,13 +150,13 @@ public final class L2World
 	{
 		for (L2Object o : objects)
 		{
-			_allObjects.remove(o.getObjectId()); // suggestion by whatev
+			_allObjects.remove(o.getObjectId());
 			_allObjectsDebug.remove(o.getObjectId());
 		}
 	}
 	
 	/**
-	 * <B><U> Example of use </U> :</B> <li>Client packets : Action, AttackRequest, RequestJoinParty, RequestJoinPledge...</li><BR>
+	 * <B><U> Example of use </U> :</B> <li>Client packets : Action, AttackRequest, RequestJoinParty, RequestJoinPledge...</li>
 	 * @param oID Identifier of the L2Object
 	 * @return the L2Object object that belongs to an ID or null if no object found.
 	 */
@@ -176,8 +176,7 @@ public final class L2World
 	}
 	
 	/**
-	 * Get the count of all visible objects in world.<br>
-	 * <br>
+	 * Get the count of all visible objects in world.
 	 * @return count off all L2World objects
 	 */
 	public final int getAllVisibleObjectsCount()
@@ -289,9 +288,9 @@ public final class L2World
 	{
 		// If selected L2Object is a L2PcIntance, add it in L2ObjectHashSet(L2PcInstance) _allPlayers of L2World
 		// XXX TODO: this code should be obsoleted by protection in putObject func...
-		if (object instanceof L2PcInstance)
+		if (object.isPlayer())
 		{
-			L2PcInstance player = (L2PcInstance) object;
+			L2PcInstance player = object.getActingPlayer();
 			
 			if (!player.isTeleporting())
 			{
@@ -403,11 +402,12 @@ public final class L2World
 			object.getKnownList().removeAllKnownObjects();
 			
 			// If selected L2Object is a L2PcIntance, remove it from L2ObjectHashSet(L2PcInstance) _allPlayers of L2World
-			if (object instanceof L2PcInstance)
+			if (object.isPlayer())
 			{
-				if (!((L2PcInstance) object).isTeleporting())
+				final L2PcInstance player = object.getActingPlayer();
+				if (!player.isTeleporting())
 				{
-					removeFromAllPlayers((L2PcInstance) object);
+					removeFromAllPlayers(player);
 				}
 				
 				// If selected L2Object is a GM L2PcInstance, remove it from Set(L2PcInstance) _gmList of GmListTable

+ 24 - 12
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Character.java

@@ -4270,9 +4270,13 @@ public abstract class L2Character extends L2Object
 		StatusUpdate su = null;
 		for (Stats stat : stats)
 		{
-			if (isSummon() && (((L2Summon) this).getOwner() != null))
+			if (isSummon())
 			{
-				((L2Summon) this).updateAndBroadcastStatus(1);
+				L2Summon summon = (L2Summon) this;
+				if (summon.getOwner() != null)
+				{
+					summon.updateAndBroadcastStatus(1);
+				}
 				break;
 				
 			}
@@ -4292,26 +4296,34 @@ public abstract class L2Character extends L2Object
 				}
 				su.addAttribute(StatusUpdate.CAST_SPD, getMAtkSpd());
 			}
-			else if ((stat == Stats.MAX_HP) && isL2Attackable())
+			else if ((stat == Stats.MAX_HP))
 			{
 				if (su == null)
 				{
 					su = new StatusUpdate(this);
 				}
-				su.addAttribute(StatusUpdate.MAX_HP, getMaxVisibleHp());
+				su.addAttribute(StatusUpdate.MAX_HP, isL2Attackable() ? getMaxVisibleHp() : getMaxHp());
 			}
 			else if (stat == Stats.LIMIT_HP)
 			{
 				getStatus().setCurrentHp(getCurrentHp()); // start regeneration if needed
 			}
-			/*
-			 * else if (stat == Stats.MAX_CP) { if (isPlayer()) { if (su == null) su = new StatusUpdate(getObjectId()); su.addAttribute(StatusUpdate.MAX_CP, getMaxCp()); } }
-			 */
-			// else if (stat==Stats.MAX_MP)
-			// {
-			// if (su == null) su = new StatusUpdate(getObjectId());
-			// su.addAttribute(StatusUpdate.MAX_MP, getMaxMp());
-			// }
+			else if ((stat == Stats.MAX_MP))
+			{
+				if (su == null)
+				{
+					su = new StatusUpdate(this);
+				}
+				su.addAttribute(StatusUpdate.MAX_MP, getMaxMp());
+			}
+			else if ((stat == Stats.MAX_CP))
+			{
+				if (su == null)
+				{
+					su = new StatusUpdate(this);
+				}
+				su.addAttribute(StatusUpdate.MAX_CP, getMaxCp());
+			}
 			else if (stat == Stats.RUN_SPEED)
 			{
 				broadcastFull = true;

+ 1 - 12
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncTemplate.java

@@ -15,7 +15,6 @@
 package com.l2jserver.gameserver.model.skills.funcs;
 
 import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -88,17 +87,7 @@ public final class FuncTemplate
 			}
 			return f;
 		}
-		catch (IllegalAccessException e)
-		{
-			_log.log(Level.WARNING, "", e);
-			return null;
-		}
-		catch (InstantiationException e)
-		{
-			_log.log(Level.WARNING, "", e);
-			return null;
-		}
-		catch (InvocationTargetException e)
+		catch (Exception e)
 		{
 			_log.log(Level.WARNING, "", e);
 			return null;

+ 5 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/stats/Stats.java

@@ -53,7 +53,7 @@ public enum Stats
 	MAGIC_REUSE_RATE("mReuse"), // Magic Skill Reuse Rate
 	SHIELD_DEFENCE("sDef"),
 	CRITICAL_DAMAGE("cAtk"),
-	CRITICAL_DAMAGE_ADD("cAtkAdd"), // this is another type for special critical damage mods - vicious stance, crit power and crit damage SA
+	CRITICAL_DAMAGE_ADD("cAtkAdd"), // this is another type for special critical damage mods - vicious stance, critical power and critical damage SA
 	// it was totally bad since now...
 	MAGIC_CRIT_DMG("mCritPower"),
 	
@@ -112,10 +112,10 @@ public enum Stats
 	FALL("fall"),
 	AGGRESSION("aggression"), // locks a mob on tank caster
 	BLEED("bleed"), // by daggers, like poison
-	POISON("poison"), // by magic, hp dmg over time
+	POISON("poison"), // by magic, damage over time
 	STUN("stun"), // disable move/ATTACK for a period of time
 	ROOT("root"), // disable movement, but not ATTACK
-	MOVEMENT("movement"), // slowdown movement, debuff
+	MOVEMENT("movement"), // slow-down movement, de-buff
 	CONFUSION("confusion"), // mob changes target, opposite to aggression/hate
 	SLEEP("sleep"), // sleep (don't move/ATTACK) until attacked
 	
@@ -136,8 +136,8 @@ public enum Stats
 	DERANGEMENT_VULN("derangementVuln"),
 	DEBUFF_VULN("debuffVuln"),
 	BUFF_VULN("buffVuln"),
-	CRIT_VULN("critVuln"), // Resistence to Crit DMG in percent.
-	CRIT_ADD_VULN("critAddVuln"), // Resistence to Crit DMG in value (ex: +100 will be 100 more crit dmg, NOT 100% more).
+	CRIT_VULN("critVuln"), // Resistance to critical damage in percent.
+	CRIT_ADD_VULN("critAddVuln"), // Resistance to critical damage in value (Example: +100 will be 100 more critical damage, NOT 100% more).
 	MAGIC_DAMAGE_VULN("magicDamVul"),
 	VALAKAS_VULN("valakasVuln"),