Bladeren bron

BETA: Minor changes.
* Added some missing !JavaDocs.
* Using Java's `HashMap` at `SkillData` instead of Trove's map implementation.
* Changed XXX in comments for TODO, so they will display properly on Eclipse's task lists.

Zoey76 11 jaren geleden
bovenliggende
commit
f7d9ae9efe

+ 14 - 9
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/SkillData.java

@@ -18,7 +18,10 @@
  */
 package com.l2jserver.gameserver.datatables;
 
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -28,19 +31,16 @@ import com.l2jserver.gameserver.engines.DocumentEngine;
 import com.l2jserver.gameserver.model.holders.SkillHolder;
 import com.l2jserver.gameserver.model.skills.Skill;
 
-import gnu.trove.list.array.TIntArrayList;
-import gnu.trove.map.hash.TIntIntHashMap;
-
 /**
- * Skill table.
+ * Skill data.
  */
 public final class SkillData
 {
 	private static Logger _log = Logger.getLogger(SkillData.class.getName());
 	
 	private final Map<Integer, Skill> _skills = new HashMap<>();
-	private final TIntIntHashMap _skillMaxLevel = new TIntIntHashMap();
-	private final TIntArrayList _enchantable = new TIntArrayList();
+	private final Map<Integer, Integer> _skillMaxLevel = new HashMap<>();
+	private final List<Integer> _enchantable = new ArrayList<>();
 	
 	protected SkillData()
 	{
@@ -81,8 +81,8 @@ public final class SkillData
 			}
 		}
 		
-		// Sorting for binarySearch
-		_enchantable.sort();
+		// Sorting for binary-search.
+		Collections.sort(_enchantable);
 	}
 	
 	/**
@@ -135,9 +135,14 @@ public final class SkillData
 		return _skillMaxLevel.get(skillId);
 	}
 	
+	/**
+	 * Verifies if the given skill ID correspond to an enchantable skill.
+	 * @param skillId the skill ID
+	 * @return {@code true} if the skill is enchantable, {@code false} otherwise
+	 */
 	public boolean isEnchantable(int skillId)
 	{
-		return _enchantable.binarySearch(skillId) >= 0;
+		return Collections.binarySearch(_enchantable, skillId) >= 0;
 	}
 	
 	/**

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/entity/TvTEvent.java

@@ -217,7 +217,7 @@ public class TvTEvent
 			0
 		}, priority = 0, highestLevelPlayerId;
 		L2PcInstance highestLevelPlayer;
-		// XXX: allParticipants should be sorted by level instead of using highestLevelPcInstanceOf for every fetch
+		// TODO: allParticipants should be sorted by level instead of using highestLevelPcInstanceOf for every fetch
 		while (!allParticipants.isEmpty())
 		{
 			// Priority team gets one player
@@ -232,7 +232,7 @@ public class TvTEvent
 				break;
 			}
 			// The other team gets one player
-			// XXX: Code not dry
+			// TODO: Code not dry
 			priority = 1 - priority;
 			highestLevelPlayerId = highestLevelPcInstanceOf(allParticipants);
 			highestLevelPlayer = allParticipants.get(highestLevelPlayerId);

+ 2 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/Skill.java

@@ -73,7 +73,7 @@ import com.l2jserver.util.Rnd;
 
 public final class Skill implements IChanceSkillTrigger, IIdentifiable
 {
-	protected static final Logger _log = Logger.getLogger(Skill.class.getName());
+	private static final Logger _log = Logger.getLogger(Skill.class.getName());
 	
 	private static final L2Object[] EMPTY_TARGET_LIST = new L2Object[0];
 	
@@ -109,6 +109,7 @@ public final class Skill implements IChanceSkillTrigger, IIdentifiable
 	private final int _mpConsume;
 	/** Initial MP consumption. */
 	private final int _mpInitialConsume;
+	/** MP consumption per channeling. */
 	private final int _mpPerChanneling;
 	/** HP consumption. */
 	private final int _hpConsume;

+ 10 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/SkillOperateType.java

@@ -87,7 +87,8 @@ public enum SkillOperateType
 	T;
 	
 	/**
-	 * @return {@code true} if the operative skill type is active, {@code false} otherwise.
+	 * Verifies if the operative type correspond to an active skill.
+	 * @return {@code true} if the operative skill type is active, {@code false} otherwise
 	 */
 	public boolean isActive()
 	{
@@ -108,7 +109,8 @@ public enum SkillOperateType
 	}
 	
 	/**
-	 * @return {@code true} if the operative skill type is continuous, {@code false} otherwise.
+	 * Verifies if the operative type correspond to a continuous skill.
+	 * @return {@code true} if the operative skill type is continuous, {@code false} otherwise
 	 */
 	public boolean isContinuous()
 	{
@@ -125,7 +127,8 @@ public enum SkillOperateType
 	}
 	
 	/**
-	 * @return {@code true} if the operative skill type is passive, {@code false} otherwise.
+	 * Verifies if the operative type correspond to a passive skill.
+	 * @return {@code true} if the operative skill type is passive, {@code false} otherwise
 	 */
 	public boolean isPassive()
 	{
@@ -133,7 +136,8 @@ public enum SkillOperateType
 	}
 	
 	/**
-	 * @return {@code true} if the operative skill type is toggle, {@code false} otherwise.
+	 * Verifies if the operative type correspond to a toggle skill.
+	 * @return {@code true} if the operative skill type is toggle, {@code false} otherwise
 	 */
 	public boolean isToggle()
 	{
@@ -141,7 +145,8 @@ public enum SkillOperateType
 	}
 	
 	/**
-	 * @return {@code true} if the operative skill type is channeling, {@code false} otherwise.
+	 * Verifies if the operative type correspond to a channeling skill.
+	 * @return {@code true} if the operative skill type is channeling, {@code false} otherwise
 	 */
 	public boolean isChanneling()
 	{

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/stats/Formulas.java

@@ -1852,7 +1852,7 @@ public final class Formulas
 			counterdmg *= calcAttributeBonus(attacker, target, skill);
 			
 			attacker.reduceCurrentHp(counterdmg, target, skill);
-			if (crit) // XXX: It counters multiple times depending on how much effects skill has not on critical, but gotta be verified first!
+			if (crit) // TODO: It counters multiple times depending on how much effects skill has not on critical, but gotta be verified first!
 			{
 				attacker.reduceCurrentHp(counterdmg, target, skill);
 			}

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/zone/type/L2DynamicZone.java

@@ -84,7 +84,7 @@ public class L2DynamicZone extends L2ZoneType
 	{
 		if (character.isPlayer())
 		{
-			character.sendMessage("You have left a temporary zone!"); // XXX: Custom message?
+			character.sendMessage("You have left a temporary zone!"); // TODO: Custom message?
 		}
 		
 		if (character == _owner)