From 826ff9be439f32ed53a446a603c891ab5d5bae82 Mon Sep 17 00:00:00 2001 From: Nos <NosBit@users.noreply.github.com> Date: Tue, 1 Oct 2013 11:22:11 +0000 Subject: [PATCH] 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 --- .../handlers/effecthandlers/AttackTrait.java | 24 ++++++++++++----- .../handlers/effecthandlers/DefenceTrait.java | 26 ++++++++++++------- .../game/data/stats/skills/04400-04499.xml | 26 +++++++++---------- 3 files changed, 47 insertions(+), 29 deletions(-) diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/AttackTrait.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/AttackTrait.java index 5210edae27..08a93fdeb1 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/AttackTrait.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/AttackTrait.java @@ -38,7 +38,7 @@ public class AttackTrait extends L2Effect { 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 @@ -54,12 +54,12 @@ public class AttackTrait extends L2Effect try { 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); } 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) { @@ -85,9 +85,14 @@ public class AttackTrait extends L2Effect final CharStat charStat = getEffected().getStat(); 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()]++; } } @@ -100,9 +105,14 @@ public class AttackTrait extends L2Effect final CharStat charStat = getEffected().getStat(); 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()]--; } } diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/DefenceTrait.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/DefenceTrait.java index fb4617dce1..190a6bd663 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/DefenceTrait.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/DefenceTrait.java @@ -38,7 +38,7 @@ public class DefenceTrait extends L2Effect { 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 @@ -54,12 +54,12 @@ public class DefenceTrait extends L2Effect try { 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); } 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) { @@ -85,11 +85,15 @@ public class DefenceTrait extends L2Effect final CharStat charStat = getEffected().getStat(); 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()]++; } else @@ -107,11 +111,15 @@ public class DefenceTrait extends L2Effect final CharStat charStat = getEffected().getStat(); 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()]--; } else diff --git a/L2J_DataPack_BETA/dist/game/data/stats/skills/04400-04499.xml b/L2J_DataPack_BETA/dist/game/data/stats/skills/04400-04499.xml index 5c9456745c..75b197f76d 100644 --- a/L2J_DataPack_BETA/dist/game/data/stats/skills/04400-04499.xml +++ b/L2J_DataPack_BETA/dist/game/data/stats/skills/04400-04499.xml @@ -258,18 +258,18 @@ <skill id="4416" levels="25" name="Races"> <!-- 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="#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="#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="#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="#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="#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="#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="#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="#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="#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="#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="#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="magicLvl" val="1" /> <set name="operateType" val="P" /> @@ -295,8 +295,8 @@ <!-- 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="#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="#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="#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="#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="#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> -- GitLab