Minor code improvements.

This commit is contained in:
MobiusDev
2016-12-11 20:32:47 +00:00
parent 6a2ccc62e4
commit 70f0330eb0
182 changed files with 1006 additions and 1328 deletions

View File

@@ -84,7 +84,7 @@ public class ActionData implements IGameXmlReader
* Gets the single instance of ActionData.
* @return single instance of ActionData
*/
public static final ActionData getInstance()
public static ActionData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -128,7 +128,7 @@ public class AlchemyData implements IGameXmlReader
* Gets the single instance of AlchemyData.
* @return single instance of AlchemyData
*/
public static final AlchemyData getInstance()
public static AlchemyData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -160,7 +160,7 @@ public class CubicData implements IGameXmlReader
* Gets the single instance of CubicData.
* @return single instance of CubicData
*/
public static final CubicData getInstance()
public static CubicData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -128,7 +128,7 @@ public class DailyMissionData implements IGameXmlReader
* Gets the single instance of DailyMissionData.
* @return single instance of DailyMissionData
*/
public static final DailyMissionData getInstance()
public static DailyMissionData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -110,7 +110,7 @@ public class EnchantItemHPBonusData implements IGameXmlReader
* Gets the single instance of EnchantHPBonusData.
* @return single instance of EnchantHPBonusData
*/
public static final EnchantItemHPBonusData getInstance()
public static EnchantItemHPBonusData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -191,7 +191,7 @@ public class EnsoulData implements IGameXmlReader
* Gets the single instance of EnsoulData.
* @return single instance of EnsoulData
*/
public static final EnsoulData getInstance()
public static EnsoulData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -60,7 +60,7 @@ public class NpcData implements IGameXmlReader
private final Map<Integer, L2NpcTemplate> _npcs = new HashMap<>();
private final Map<String, Integer> _clans = new HashMap<>();
private final static List<Integer> _masterMonsterIDs = new ArrayList<>();
private static final List<Integer> _masterMonsterIDs = new ArrayList<>();
protected NpcData()
{
@@ -525,49 +525,46 @@ public class NpcData implements IGameXmlReader
aiSkillScopes.add(shortOrLongRangeScope);
}
}
else if (skill.hasEffectType(L2EffectType.DISPEL, L2EffectType.DISPEL_BY_SLOT))
{
aiSkillScopes.add(AISkillScope.NEGATIVE);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.HEAL))
{
aiSkillScopes.add(AISkillScope.HEAL);
}
else if (skill.hasEffectType(L2EffectType.PHYSICAL_ATTACK, L2EffectType.PHYSICAL_ATTACK_HP_LINK, L2EffectType.MAGICAL_ATTACK, L2EffectType.DEATH_LINK, L2EffectType.HP_DRAIN))
{
aiSkillScopes.add(AISkillScope.ATTACK);
aiSkillScopes.add(AISkillScope.UNIVERSAL);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.SLEEP))
{
aiSkillScopes.add(AISkillScope.IMMOBILIZE);
}
else if (skill.hasEffectType(L2EffectType.BLOCK_ACTIONS, L2EffectType.ROOT))
{
aiSkillScopes.add(AISkillScope.IMMOBILIZE);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.MUTE, L2EffectType.BLOCK_CONTROL))
{
aiSkillScopes.add(AISkillScope.COT);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.DMG_OVER_TIME, L2EffectType.DMG_OVER_TIME_PERCENT))
{
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.RESURRECTION))
{
aiSkillScopes.add(AISkillScope.RES);
}
else
{
if (skill.hasEffectType(L2EffectType.DISPEL, L2EffectType.DISPEL_BY_SLOT))
{
aiSkillScopes.add(AISkillScope.NEGATIVE);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.HEAL))
{
aiSkillScopes.add(AISkillScope.HEAL);
}
else if (skill.hasEffectType(L2EffectType.PHYSICAL_ATTACK, L2EffectType.PHYSICAL_ATTACK_HP_LINK, L2EffectType.MAGICAL_ATTACK, L2EffectType.DEATH_LINK, L2EffectType.HP_DRAIN))
{
aiSkillScopes.add(AISkillScope.ATTACK);
aiSkillScopes.add(AISkillScope.UNIVERSAL);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.SLEEP))
{
aiSkillScopes.add(AISkillScope.IMMOBILIZE);
}
else if (skill.hasEffectType(L2EffectType.BLOCK_ACTIONS, L2EffectType.ROOT))
{
aiSkillScopes.add(AISkillScope.IMMOBILIZE);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.MUTE, L2EffectType.BLOCK_CONTROL))
{
aiSkillScopes.add(AISkillScope.COT);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.DMG_OVER_TIME, L2EffectType.DMG_OVER_TIME_PERCENT))
{
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.RESURRECTION))
{
aiSkillScopes.add(AISkillScope.RES);
}
else
{
aiSkillScopes.add(AISkillScope.UNIVERSAL);
}
aiSkillScopes.add(AISkillScope.UNIVERSAL);
}
}

View File

@@ -121,7 +121,7 @@ public class OptionData implements IGameXmlReader
* Gets the single instance of OptionsData.
* @return single instance of OptionsData
*/
public static final OptionData getInstance()
public static OptionData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -182,7 +182,7 @@ public final class PlayerTemplateData implements IGameXmlReader
return _playerTemplates.get(ClassId.getClassId(classId));
}
public static final PlayerTemplateData getInstance()
public static PlayerTemplateData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -101,7 +101,7 @@ public final class ResidenceFunctionsData implements IGameXmlReader
return _functions.get(id);
}
public static final ResidenceFunctionsData getInstance()
public static ResidenceFunctionsData getInstance()
{
return SingletonHolder.INSTANCE;
}

View File

@@ -103,7 +103,7 @@ public class SayuneData implements IGameXmlReader
* Gets the single instance of SayuneData.
* @return single instance of SayuneData
*/
public static final SayuneData getInstance()
public static SayuneData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -115,7 +115,7 @@ public class SiegeScheduleData implements IGameXmlReader
return _scheduleData;
}
public static final SiegeScheduleData getInstance()
public static SiegeScheduleData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -490,7 +490,7 @@ public class SkillData implements IGameXmlReader
final String stringGeneralValue = String.valueOf(generalValue);
if (stringGeneralValue.startsWith("@"))
{
Map<Integer, Map<Integer, Object>> variableValue = variableValues.get(stringGeneralValue);
final Map<Integer, Map<Integer, Object>> variableValue = variableValues.get(stringGeneralValue);
if (variableValue != null)
{
values = variableValue;
@@ -546,11 +546,11 @@ public class SkillData implements IGameXmlReader
{
for (int j = fromSubLevel; j <= toSubLevel; j++)
{
Map<Integer, Object> subValues = values.computeIfAbsent(i, k -> new HashMap<>());
Map<String, Double> variables = new HashMap<>();
final Map<Integer, Object> subValues = values.computeIfAbsent(i, k -> new HashMap<>());
final Map<String, Double> variables = new HashMap<>();
variables.put("index", (i - fromLevel) + 1d);
variables.put("subIndex", (j - fromSubLevel) + 1d);
Object base = values.getOrDefault(i, Collections.emptyMap()).get(-1);
final Object base = values.getOrDefault(i, Collections.emptyMap()).get(-1);
if ((base != null) && !(base instanceof StatsSet))
{
variables.put("base", Double.parseDouble(String.valueOf(base)));