Skip to content
Snippets Groups Projects
Commit 826ff9be authored by Nos's avatar Nos
Browse files

BETA: Fixed a bug where trait with value 0 would count as an activated trait.

    * Fixed trait values in Races and Race Types skills.

Reported by: pandragon    
Reviewed by: UnAfraid
parent 85cde54b
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,7 @@ public class AttackTrait extends L2Effect ...@@ -38,7 +38,7 @@ public class AttackTrait extends L2Effect
{ {
private static final Logger _log = Logger.getLogger(AttackTrait.class.getName()); private static final Logger _log = Logger.getLogger(AttackTrait.class.getName());
private final Map<TraitType, Float> _attackTraits = new HashMap<>(); private final Map<TraitType, Integer> _attackTraits = new HashMap<>();
/** /**
* @param env * @param env
...@@ -54,12 +54,12 @@ public class AttackTrait extends L2Effect ...@@ -54,12 +54,12 @@ public class AttackTrait extends L2Effect
try try
{ {
final TraitType traitType = TraitType.valueOf(param.getKey()); final TraitType traitType = TraitType.valueOf(param.getKey());
final float value = (Float.parseFloat((String) param.getValue()) + 100) / 100; final int value = Integer.parseInt((String) param.getValue());
_attackTraits.put(traitType, value); _attackTraits.put(traitType, value);
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
_log.warning(getClass().getSimpleName() + ": value of " + param.getKey() + " enum must be float value " + param.getValue() + " found."); _log.warning(getClass().getSimpleName() + ": value of " + param.getKey() + " enum must be int value " + param.getValue() + " found.");
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -85,9 +85,14 @@ public class AttackTrait extends L2Effect ...@@ -85,9 +85,14 @@ public class AttackTrait extends L2Effect
final CharStat charStat = getEffected().getStat(); final CharStat charStat = getEffected().getStat();
synchronized (charStat.getAttackTraits()) synchronized (charStat.getAttackTraits())
{ {
for (Entry<TraitType, Float> trait : _attackTraits.entrySet()) for (Entry<TraitType, Integer> trait : _attackTraits.entrySet())
{ {
charStat.getAttackTraits()[trait.getKey().getId()] *= trait.getValue(); if (trait.getValue() == 0)
{
continue;
}
charStat.getAttackTraits()[trait.getKey().getId()] *= (trait.getValue() + 100) / 100f;
charStat.getAttackTraitsCount()[trait.getKey().getId()]++; charStat.getAttackTraitsCount()[trait.getKey().getId()]++;
} }
} }
...@@ -100,9 +105,14 @@ public class AttackTrait extends L2Effect ...@@ -100,9 +105,14 @@ public class AttackTrait extends L2Effect
final CharStat charStat = getEffected().getStat(); final CharStat charStat = getEffected().getStat();
synchronized (charStat.getAttackTraits()) synchronized (charStat.getAttackTraits())
{ {
for (Entry<TraitType, Float> trait : _attackTraits.entrySet()) for (Entry<TraitType, Integer> trait : _attackTraits.entrySet())
{ {
charStat.getAttackTraits()[trait.getKey().getId()] /= trait.getValue(); if (trait.getValue() == 0)
{
continue;
}
charStat.getAttackTraits()[trait.getKey().getId()] /= (trait.getValue() + 100) / 100f;
charStat.getAttackTraitsCount()[trait.getKey().getId()]--; charStat.getAttackTraitsCount()[trait.getKey().getId()]--;
} }
} }
......
...@@ -38,7 +38,7 @@ public class DefenceTrait extends L2Effect ...@@ -38,7 +38,7 @@ public class DefenceTrait extends L2Effect
{ {
private static final Logger _log = Logger.getLogger(DefenceTrait.class.getName()); private static final Logger _log = Logger.getLogger(DefenceTrait.class.getName());
private final Map<TraitType, Float> _defenceTraits = new HashMap<>(); private final Map<TraitType, Integer> _defenceTraits = new HashMap<>();
/** /**
* @param env * @param env
...@@ -54,12 +54,12 @@ public class DefenceTrait extends L2Effect ...@@ -54,12 +54,12 @@ public class DefenceTrait extends L2Effect
try try
{ {
final TraitType traitType = TraitType.valueOf(param.getKey()); final TraitType traitType = TraitType.valueOf(param.getKey());
final float value = (Float.parseFloat((String) param.getValue()) + 100) / 100; final int value = Integer.parseInt((String) param.getValue());
_defenceTraits.put(traitType, value); _defenceTraits.put(traitType, value);
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
_log.warning(getClass().getSimpleName() + ": value of " + param.getKey() + " enum must be float value " + param.getValue() + " found."); _log.warning(getClass().getSimpleName() + ": value of " + param.getKey() + " enum must be int value " + param.getValue() + " found.");
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -85,11 +85,15 @@ public class DefenceTrait extends L2Effect ...@@ -85,11 +85,15 @@ public class DefenceTrait extends L2Effect
final CharStat charStat = getEffected().getStat(); final CharStat charStat = getEffected().getStat();
synchronized (charStat.getDefenceTraits()) synchronized (charStat.getDefenceTraits())
{ {
for (Entry<TraitType, Float> trait : _defenceTraits.entrySet()) for (Entry<TraitType, Integer> trait : _defenceTraits.entrySet())
{ {
if (trait.getValue() < 2.0f) if (trait.getValue() == 0)
{ {
charStat.getDefenceTraits()[trait.getKey().getId()] *= trait.getValue(); continue;
}
else if (trait.getValue() < 100)
{
charStat.getDefenceTraits()[trait.getKey().getId()] *= (trait.getValue() + 100) / 100f;
charStat.getDefenceTraitsCount()[trait.getKey().getId()]++; charStat.getDefenceTraitsCount()[trait.getKey().getId()]++;
} }
else else
...@@ -107,11 +111,15 @@ public class DefenceTrait extends L2Effect ...@@ -107,11 +111,15 @@ public class DefenceTrait extends L2Effect
final CharStat charStat = getEffected().getStat(); final CharStat charStat = getEffected().getStat();
synchronized (charStat.getDefenceTraits()) synchronized (charStat.getDefenceTraits())
{ {
for (Entry<TraitType, Float> trait : _defenceTraits.entrySet()) for (Entry<TraitType, Integer> trait : _defenceTraits.entrySet())
{ {
if (trait.getValue() < 2.0f) if (trait.getValue() == 0)
{
continue;
}
else if (trait.getValue() < 100)
{ {
charStat.getDefenceTraits()[trait.getKey().getId()] /= trait.getValue(); charStat.getDefenceTraits()[trait.getKey().getId()] /= (trait.getValue() + 100) / 100f;
charStat.getDefenceTraitsCount()[trait.getKey().getId()]--; charStat.getDefenceTraitsCount()[trait.getKey().getId()]--;
} }
else else
......
...@@ -258,18 +258,18 @@ ...@@ -258,18 +258,18 @@
<skill id="4416" levels="25" name="Races"> <skill id="4416" levels="25" name="Races">
<!-- Confirmed CT2.5 --> <!-- Confirmed CT2.5 -->
<table name="#icons"> icon.skill4290 icon.skill4291 icon.skill4292 icon.skill4293 icon.skill4294 icon.skill4295 icon.skill4296 icon.skill4297 icon.skill4298 icon.skill4299 icon.skill4300 icon.skill4301 icon.skill4302 icon.skill4416_human icon.skill4416_elf icon.skill4416_darkelf icon.skill4416_orc icon.skill4416_dwarf icon.skill4416_etc icon.skill4416_none icon.skill4416_siegeweapon icon.skill4416_castleguard icon.skill4416_mercenary icon.skill4416_none icon.skill4296 </table> <table name="#icons"> icon.skill4290 icon.skill4291 icon.skill4292 icon.skill4293 icon.skill4294 icon.skill4295 icon.skill4296 icon.skill4297 icon.skill4298 icon.skill4299 icon.skill4300 icon.skill4301 icon.skill4302 icon.skill4416_human icon.skill4416_elf icon.skill4416_darkelf icon.skill4416_orc icon.skill4416_dwarf icon.skill4416_etc icon.skill4416_none icon.skill4416_siegeweapon icon.skill4416_castleguard icon.skill4416_mercenary icon.skill4416_none icon.skill4296 </table>
<table name="#pDefAnimals"> 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table> <table name="#pDefAnimals"> 0 0 0 -15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table>
<table name="#pDefBeasts"> 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table> <table name="#pDefBeasts"> 0 0 -15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table>
<table name="#pDefBlunts"> 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table> <table name="#pDefBlunts"> 0 0 0 0 0 0 0 0 -15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table>
<table name="#pDefBows"> 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table> <table name="#pDefBows"> 0 0 0 -15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table>
<table name="#pDefBugs"> 0 0 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 </table> <table name="#pDefBugs"> 0 0 0 0 0 0 0 0 0 0 0 -15 0 0 0 0 0 0 0 0 0 0 0 0 0 </table>
<table name="#pDefDragons"> 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table> <table name="#pDefDragons"> 0 0 0 0 0 0 0 0 0 -15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table>
<table name="#pDefDuals"> 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table> <table name="#pDefDuals"> 0 0 0 0 0 0 0 0 0 -15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table>
<table name="#pDefGiants"> 0 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table> <table name="#pDefGiants"> 0 0 0 0 0 0 0 0 0 0 -15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table>
<table name="#pDefMagicCreatures"> 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table> <table name="#pDefMagicCreatures"> 0 -15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table>
<table name="#pDefPlants"> 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table> <table name="#pDefPlants"> 0 0 0 0 -15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table>
<table name="#pDefShocks"> 0 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table> <table name="#pDefShocks"> 0 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table>
<table name="#pDefSwords"> 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table> <table name="#pDefSwords"> 0 0 0 0 0 0 0 0 0 -15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </table>
<set name="icon" val="#icons" /> <set name="icon" val="#icons" />
<set name="magicLvl" val="1" /> <set name="magicLvl" val="1" />
<set name="operateType" val="P" /> <set name="operateType" val="P" />
...@@ -295,8 +295,8 @@ ...@@ -295,8 +295,8 @@
<!-- Confirmed CT2.5 --> <!-- Confirmed CT2.5 -->
<table name="#icons"> icon.skill4293 icon.skill4292 icon.skill4292 icon.skill4292 icon.skill4292 icon.skill4301 icon.skill4301 icon.skill4301 icon.skill4291 icon.skill4291 icon.skill4291 icon.skill4298 icon.skill4298 icon.skill4298 icon.skill4297 icon.skill4297 icon.skill4297 icon.skill4299 icon.skill4296 icon.skill4296 icon.skill4296 icon.skill4296 icon.skill4296 icon.skill4302 icon.skill4300 icon.skill4295 icon.skill4295 icon.skill4295 icon.skill4295 icon.skill4295 icon.skill4295 icon.skill4295 icon.skill4294 icon.skill4290 icon.skill4290 icon.skill4290 icon.skill4290 icon.skill4290 </table> <table name="#icons"> icon.skill4293 icon.skill4292 icon.skill4292 icon.skill4292 icon.skill4292 icon.skill4301 icon.skill4301 icon.skill4301 icon.skill4291 icon.skill4291 icon.skill4291 icon.skill4298 icon.skill4298 icon.skill4298 icon.skill4297 icon.skill4297 icon.skill4297 icon.skill4299 icon.skill4296 icon.skill4296 icon.skill4296 icon.skill4296 icon.skill4296 icon.skill4302 icon.skill4300 icon.skill4295 icon.skill4295 icon.skill4295 icon.skill4295 icon.skill4295 icon.skill4295 icon.skill4295 icon.skill4294 icon.skill4290 icon.skill4290 icon.skill4290 icon.skill4290 icon.skill4290 </table>
<table name="#pDefBleed"> 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 0 </table> <table name="#pDefBleed"> 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 0 </table>
<table name="#pDefBlunts"> 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 </table> <table name="#pDefBlunts"> 0 0 0 0 0 0 0 0 0 -15 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 </table>
<table name="#pDefBows"> 0 0 15 15 15 0 0 15 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 </table> <table name="#pDefBows"> 0 0 -15 -15 -15 0 0 -15 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 </table>
<table name="#pDefDagger"> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 </table> <table name="#pDefDagger"> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 </table>
<table name="#pDefDualDagger"> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 </table> <table name="#pDefDualDagger"> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 </table>
<table name="#pDefHold"> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 </table> <table name="#pDefHold"> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 </table>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment