From a83b7b4c629a2b14c3bd57be24fa8c209d9bee44 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Thu, 21 Jan 2021 23:18:45 +0000 Subject: [PATCH] Addition of EnchantRate effect handler. Contributed by facab. --- .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../handlers/itemhandlers/CharmOfCourage.java | 2 +- .../game/data/stats/skills/09300-09399.xml | 8 +++++ .../game/data/stats/skills/documentation.txt | 1 + .../model/actor/instance/PlayerInstance.java | 4 +-- .../model/itemcontainer/Inventory.java | 2 +- .../model/items/enchant/EnchantScroll.java | 6 +++- .../model/items/type/CrystalType.java | 14 ++++----- .../gameserver/model/stats/Stat.java | 1 + .../serverpackets/ShopPreviewList.java | 4 +-- .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../handlers/itemhandlers/CharmOfCourage.java | 2 +- .../game/data/stats/skills/09300-09399.xml | 8 +++++ .../game/data/stats/skills/documentation.txt | 1 + .../model/actor/instance/PlayerInstance.java | 4 +-- .../model/itemcontainer/Inventory.java | 2 +- .../model/items/enchant/EnchantScroll.java | 6 +++- .../model/items/type/CrystalType.java | 14 ++++----- .../gameserver/model/stats/Stat.java | 1 + .../serverpackets/ShopPreviewList.java | 4 +-- .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../handlers/itemhandlers/CharmOfCourage.java | 2 +- .../game/data/stats/skills/09300-09399.xml | 8 +++++ .../game/data/stats/skills/documentation.txt | 1 + .../model/actor/instance/PlayerInstance.java | 4 +-- .../model/itemcontainer/Inventory.java | 2 +- .../model/items/enchant/EnchantScroll.java | 6 +++- .../model/items/type/CrystalType.java | 14 ++++----- .../gameserver/model/stats/Stat.java | 1 + .../serverpackets/ShopPreviewList.java | 4 +-- .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../game/data/stats/skills/09300-09399.xml | 8 +++++ .../game/data/stats/skills/documentation.txt | 1 + .../model/items/enchant/EnchantScroll.java | 6 +++- .../gameserver/model/stats/Stat.java | 1 + .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../game/data/stats/skills/09300-09399.xml | 8 +++++ .../game/data/stats/skills/documentation.txt | 1 + .../model/items/enchant/EnchantScroll.java | 6 +++- .../gameserver/model/stats/Stat.java | 1 + .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../game/data/stats/skills/09300-09399.xml | 8 +++++ .../game/data/stats/skills/documentation.txt | 1 + .../model/items/enchant/EnchantScroll.java | 6 +++- .../gameserver/model/stats/Stat.java | 1 + .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../game/data/stats/skills/09300-09399.xml | 8 +++++ .../game/data/stats/skills/documentation.txt | 1 + .../model/items/enchant/EnchantScroll.java | 6 +++- .../gameserver/model/stats/Stat.java | 1 + .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../game/data/stats/skills/09300-09399.xml | 8 +++++ .../game/data/stats/skills/documentation.txt | 1 + .../model/items/enchant/EnchantScroll.java | 6 +++- .../gameserver/model/stats/Stat.java | 1 + .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../game/data/stats/skills/09300-09399.xml | 8 +++++ .../game/data/stats/skills/documentation.txt | 1 + .../model/items/enchant/EnchantScroll.java | 6 +++- .../gameserver/model/stats/Stat.java | 1 + .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../handlers/itemhandlers/CharmOfCourage.java | 2 +- .../game/data/stats/skills/documentation.txt | 1 + .../model/actor/instance/PlayerInstance.java | 4 +-- .../model/itemcontainer/Inventory.java | 2 +- .../model/items/enchant/EnchantScroll.java | 6 +++- .../model/items/type/CrystalType.java | 14 ++++----- .../gameserver/model/stats/Stat.java | 1 + .../serverpackets/ShopPreviewList.java | 4 +-- .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../handlers/itemhandlers/CharmOfCourage.java | 2 +- .../game/data/stats/skills/documentation.txt | 1 + .../model/actor/instance/PlayerInstance.java | 4 +-- .../model/itemcontainer/Inventory.java | 2 +- .../model/items/enchant/EnchantScroll.java | 6 +++- .../model/items/type/CrystalType.java | 14 ++++----- .../gameserver/model/stats/Stat.java | 1 + .../serverpackets/ShopPreviewList.java | 4 +-- .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../handlers/itemhandlers/CharmOfCourage.java | 2 +- .../game/data/stats/skills/documentation.txt | 1 + .../model/actor/instance/PlayerInstance.java | 4 +-- .../model/itemcontainer/Inventory.java | 2 +- .../model/items/enchant/EnchantScroll.java | 6 +++- .../model/items/type/CrystalType.java | 14 ++++----- .../gameserver/model/stats/Stat.java | 1 + .../serverpackets/ShopPreviewList.java | 4 +-- .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../handlers/itemhandlers/CharmOfCourage.java | 2 +- .../game/data/stats/skills/documentation.txt | 1 + .../model/actor/instance/PlayerInstance.java | 4 +-- .../model/itemcontainer/Inventory.java | 2 +- .../model/items/enchant/EnchantScroll.java | 6 +++- .../model/items/type/CrystalType.java | 14 ++++----- .../gameserver/model/stats/Stat.java | 1 + .../serverpackets/ShopPreviewList.java | 4 +-- .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../handlers/itemhandlers/CharmOfCourage.java | 2 +- .../game/data/stats/skills/documentation.txt | 1 + .../model/actor/instance/PlayerInstance.java | 4 +-- .../model/itemcontainer/Inventory.java | 2 +- .../model/items/enchant/EnchantScroll.java | 6 +++- .../model/items/type/CrystalType.java | 14 ++++----- .../gameserver/model/stats/Stat.java | 1 + .../serverpackets/ShopPreviewList.java | 4 +-- .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../handlers/itemhandlers/CharmOfCourage.java | 2 +- .../game/data/stats/skills/documentation.txt | 1 + .../model/actor/instance/PlayerInstance.java | 2 +- .../model/items/enchant/EnchantScroll.java | 6 +++- .../model/items/type/CrystalType.java | 14 ++++----- .../gameserver/model/stats/Stat.java | 1 + .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../handlers/effecthandlers/Restoration.java | 4 +-- .../effecthandlers/RestorationRandom.java | 4 +-- .../handlers/itemhandlers/CharmOfCourage.java | 2 +- .../itemhandlers/ExtractableItems.java | 4 +-- .../game/data/stats/skills/documentation.txt | 1 + .../gameserver/data/xml/BuyListData.java | 4 +-- .../gameserver/data/xml/MultisellData.java | 4 +-- .../gameserver/data/xml/NpcData.java | 4 +-- .../gameserver/data/xml/RecipeData.java | 4 +-- .../model/actor/instance/PlayerInstance.java | 4 +-- .../model/itemcontainer/Inventory.java | 2 +- .../model/items/enchant/EnchantScroll.java | 6 +++- .../model/items/type/CrystalType.java | 14 ++++----- .../gameserver/model/stats/Stat.java | 1 + .../network/clientpackets/UseItem.java | 4 +-- .../serverpackets/ShopPreviewList.java | 4 +-- .../scripts/handlers/EffectMasterHandler.java | 1 + .../handlers/effecthandlers/EnchantRate.java | 31 +++++++++++++++++++ .../handlers/itemhandlers/CharmOfCourage.java | 2 +- .../game/data/stats/skills/documentation.txt | 1 + .../model/actor/instance/PlayerInstance.java | 2 +- .../model/items/enchant/EnchantScroll.java | 6 +++- .../model/items/type/CrystalType.java | 14 ++++----- .../gameserver/model/stats/Stat.java | 1 + 153 files changed, 886 insertions(+), 168 deletions(-) create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java create mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/EffectMasterHandler.java index 625acb31bd..5e700b581d 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -134,6 +134,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java index e5fe3ff12d..100b66b06a 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java @@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler final PlayerInstance player = playable.getActingPlayer(); int level = player.getLevel(); - final int itemLevel = item.getItem().getCrystalType().getId(); + final int itemLevel = item.getItem().getCrystalType().getLevel(); if (level < 20) { level = 0; diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/09300-09399.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/09300-09399.xml index ff9d47d020..9e9c65ea21 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/09300-09399.xml +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/09300-09399.xml @@ -1542,6 +1542,14 @@ P 5 85 + + + + 10 + 15 + + + diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/documentation.txt index 8412091b1d..54fe33d15d 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/documentation.txt @@ -104,6 +104,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 0a67233a0a..0df6372bad 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2151,7 +2151,7 @@ public class PlayerInstance extends Playable { if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))) { - crystaltype = item.getItem().getCrystalType().getId(); + crystaltype = item.getItem().getCrystalType().getLevel(); if (crystaltype > expertiseLevel) { if (item.isWeapon() && (crystaltype > weaponPenalty)) @@ -8825,7 +8825,7 @@ public class PlayerInstance extends Playable { for (int itemId : _activeSoulShots) { - if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) + if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType) { disableAutoShot(itemId); } diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index ba5f6014d8..187cd0e7d2 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -451,7 +451,7 @@ public abstract class Inventory extends ItemContainer final PlayerInstance player = (PlayerInstance) inventory.getOwner(); // Any items equipped that result in expertise penalty do not give any skills at all. - if (item.getItem().getCrystalType().getId() > player.getExpertiseLevel()) + if (item.getItem().getCrystalType().getLevel() > player.getExpertiseLevel()) { return; } diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index 06da9ee495..a25d3414a7 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance) || player.tryLuck(); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java index 868c3b7443..d059efd025 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java @@ -35,14 +35,14 @@ public enum CrystalType R99(10, 17371, 30, 500), EVENT(11, 0, 0, 0); - private final int _id; + private final int _level; private final int _crystalId; private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusWeapon; - CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) + CrystalType(int level, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) { - _id = id; + _level = level; _crystalId = crystalId; _crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; @@ -52,9 +52,9 @@ public enum CrystalType * Gets the crystal type ID. * @return the crystal type ID */ - public int getId() + public int getLevel() { - return _id; + return _level; } /** @@ -78,11 +78,11 @@ public enum CrystalType public boolean isGreater(CrystalType crystalType) { - return getId() > crystalType.getId(); + return getLevel() > crystalType.getLevel(); } public boolean isLesser(CrystalType crystalType) { - return getId() < crystalType.getId(); + return getLevel() < crystalType.getLevel(); } } diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/stats/Stat.java index 641f7cce81..2ff5850eed 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -186,6 +186,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java index 8a35a663fa..788f6bf9a1 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java @@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket int newlength = 0; for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { newlength++; } @@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { packet.writeD(product.getItemId()); packet.writeH(product.getItem().getType2()); // item type2 diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/EffectMasterHandler.java index 625acb31bd..5e700b581d 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -134,6 +134,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java index e5fe3ff12d..100b66b06a 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java @@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler final PlayerInstance player = playable.getActingPlayer(); int level = player.getLevel(); - final int itemLevel = item.getItem().getCrystalType().getId(); + final int itemLevel = item.getItem().getCrystalType().getLevel(); if (level < 20) { level = 0; diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/09300-09399.xml b/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/09300-09399.xml index 2731f2deb4..0bb4787576 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/09300-09399.xml +++ b/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/09300-09399.xml @@ -1542,6 +1542,14 @@ P 5 85 + + + + 10 + 15 + + + diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/documentation.txt index 8412091b1d..54fe33d15d 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/documentation.txt @@ -104,6 +104,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 5165fb789a..11007c6fa1 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2157,7 +2157,7 @@ public class PlayerInstance extends Playable { if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))) { - crystaltype = item.getItem().getCrystalType().getId(); + crystaltype = item.getItem().getCrystalType().getLevel(); if (crystaltype > expertiseLevel) { if (item.isWeapon() && (crystaltype > weaponPenalty)) @@ -8832,7 +8832,7 @@ public class PlayerInstance extends Playable { for (int itemId : _activeSoulShots) { - if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) + if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType) { disableAutoShot(itemId); } diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 01da5df7a8..8985f2f4ac 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -454,7 +454,7 @@ public abstract class Inventory extends ItemContainer final PlayerInstance player = (PlayerInstance) inventory.getOwner(); // Any items equipped that result in expertise penalty do not give any skills at all. - if (item.getItem().getCrystalType().getId() > player.getExpertiseLevel()) + if (item.getItem().getCrystalType().getLevel() > player.getExpertiseLevel()) { return; } diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index 06da9ee495..a25d3414a7 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance) || player.tryLuck(); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java index 868c3b7443..d059efd025 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java @@ -35,14 +35,14 @@ public enum CrystalType R99(10, 17371, 30, 500), EVENT(11, 0, 0, 0); - private final int _id; + private final int _level; private final int _crystalId; private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusWeapon; - CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) + CrystalType(int level, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) { - _id = id; + _level = level; _crystalId = crystalId; _crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; @@ -52,9 +52,9 @@ public enum CrystalType * Gets the crystal type ID. * @return the crystal type ID */ - public int getId() + public int getLevel() { - return _id; + return _level; } /** @@ -78,11 +78,11 @@ public enum CrystalType public boolean isGreater(CrystalType crystalType) { - return getId() > crystalType.getId(); + return getLevel() > crystalType.getLevel(); } public boolean isLesser(CrystalType crystalType) { - return getId() < crystalType.getId(); + return getLevel() < crystalType.getLevel(); } } diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/stats/Stat.java index 641f7cce81..2ff5850eed 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -186,6 +186,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java index 8a35a663fa..788f6bf9a1 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java @@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket int newlength = 0; for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { newlength++; } @@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { packet.writeD(product.getItemId()); packet.writeH(product.getItem().getType2()); // item type2 diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/EffectMasterHandler.java index 625acb31bd..5e700b581d 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -134,6 +134,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java index e5fe3ff12d..100b66b06a 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java @@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler final PlayerInstance player = playable.getActingPlayer(); int level = player.getLevel(); - final int itemLevel = item.getItem().getCrystalType().getId(); + final int itemLevel = item.getItem().getCrystalType().getLevel(); if (level < 20) { level = 0; diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/09300-09399.xml b/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/09300-09399.xml index c6ba5deac8..345e78a799 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/09300-09399.xml +++ b/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/09300-09399.xml @@ -1542,6 +1542,14 @@ P 5 85 + + + + 10 + 15 + + + diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/documentation.txt index 8412091b1d..54fe33d15d 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/documentation.txt @@ -104,6 +104,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index b98b846242..2cd6c32c73 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2159,7 +2159,7 @@ public class PlayerInstance extends Playable { if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))) { - crystaltype = item.getItem().getCrystalType().getId(); + crystaltype = item.getItem().getCrystalType().getLevel(); if (crystaltype > expertiseLevel) { if (item.isWeapon() && (crystaltype > weaponPenalty)) @@ -8834,7 +8834,7 @@ public class PlayerInstance extends Playable { for (int itemId : _activeSoulShots) { - if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) + if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType) { disableAutoShot(itemId); } diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 01da5df7a8..8985f2f4ac 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -454,7 +454,7 @@ public abstract class Inventory extends ItemContainer final PlayerInstance player = (PlayerInstance) inventory.getOwner(); // Any items equipped that result in expertise penalty do not give any skills at all. - if (item.getItem().getCrystalType().getId() > player.getExpertiseLevel()) + if (item.getItem().getCrystalType().getLevel() > player.getExpertiseLevel()) { return; } diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index 06da9ee495..a25d3414a7 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance) || player.tryLuck(); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java index 868c3b7443..d059efd025 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java @@ -35,14 +35,14 @@ public enum CrystalType R99(10, 17371, 30, 500), EVENT(11, 0, 0, 0); - private final int _id; + private final int _level; private final int _crystalId; private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusWeapon; - CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) + CrystalType(int level, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) { - _id = id; + _level = level; _crystalId = crystalId; _crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; @@ -52,9 +52,9 @@ public enum CrystalType * Gets the crystal type ID. * @return the crystal type ID */ - public int getId() + public int getLevel() { - return _id; + return _level; } /** @@ -78,11 +78,11 @@ public enum CrystalType public boolean isGreater(CrystalType crystalType) { - return getId() > crystalType.getId(); + return getLevel() > crystalType.getLevel(); } public boolean isLesser(CrystalType crystalType) { - return getId() < crystalType.getId(); + return getLevel() < crystalType.getLevel(); } } diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/stats/Stat.java index 641f7cce81..2ff5850eed 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -186,6 +186,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java index 8a35a663fa..788f6bf9a1 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java @@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket int newlength = 0; for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { newlength++; } @@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { packet.writeD(product.getItemId()); packet.writeH(product.getItem().getType2()); // item type2 diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/EffectMasterHandler.java index 76a0246550..47dd88fd5f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -138,6 +138,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/09300-09399.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/09300-09399.xml index c6ba5deac8..345e78a799 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/09300-09399.xml +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/09300-09399.xml @@ -1542,6 +1542,14 @@ P 5 85 + + + + 10 + 15 + + + diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt index 73b152d7eb..a698be1770 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt @@ -108,6 +108,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index 06da9ee495..a25d3414a7 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance) || player.tryLuck(); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/stats/Stat.java index 62b2bb8ad6..60d7fcaa24 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -186,6 +186,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/EffectMasterHandler.java index 80e8354efc..67e81a9a7b 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -140,6 +140,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/stats/skills/09300-09399.xml b/L2J_Mobius_5.0_Salvation/dist/game/data/stats/skills/09300-09399.xml index 5004a5aa84..f4fd614f16 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/stats/skills/09300-09399.xml +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/stats/skills/09300-09399.xml @@ -1542,6 +1542,14 @@ P 5 85 + + + + 10 + 15 + + + diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_5.0_Salvation/dist/game/data/stats/skills/documentation.txt index 58c9171ba3..164b77e4b0 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/stats/skills/documentation.txt @@ -110,6 +110,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index 06da9ee495..a25d3414a7 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance) || player.tryLuck(); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/stats/Stat.java index 675b6c6011..faa2621bc2 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -188,6 +188,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/EffectMasterHandler.java index d99c1a6194..24b9877927 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -141,6 +141,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/stats/skills/09300-09399.xml b/L2J_Mobius_5.5_EtinasFate/dist/game/data/stats/skills/09300-09399.xml index 93ea2e0ff5..c3e855282c 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/stats/skills/09300-09399.xml +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/stats/skills/09300-09399.xml @@ -1543,6 +1543,14 @@ P 5 85 + + + + 10 + 15 + + + diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_5.5_EtinasFate/dist/game/data/stats/skills/documentation.txt index 88be31ceb0..584c8352a0 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/stats/skills/documentation.txt @@ -111,6 +111,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index 06da9ee495..a25d3414a7 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance) || player.tryLuck(); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/stats/Stat.java index d8790e3e16..62c27673bb 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -188,6 +188,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/EffectMasterHandler.java index d99c1a6194..24b9877927 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -141,6 +141,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/stats/skills/09300-09399.xml b/L2J_Mobius_6.0_Fafurion/dist/game/data/stats/skills/09300-09399.xml index 34bac6176a..6fedd6c427 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/stats/skills/09300-09399.xml +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/stats/skills/09300-09399.xml @@ -1543,6 +1543,14 @@ P 5 85 + + + + 10 + 15 + + + diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_6.0_Fafurion/dist/game/data/stats/skills/documentation.txt index 88be31ceb0..584c8352a0 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/stats/skills/documentation.txt @@ -111,6 +111,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index 06da9ee495..a25d3414a7 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance) || player.tryLuck(); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/stats/Stat.java index d8790e3e16..62c27673bb 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -188,6 +188,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/EffectMasterHandler.java index 8734287606..938bb474be 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -141,6 +141,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/stats/skills/09300-09399.xml b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/stats/skills/09300-09399.xml index 17195ea827..c1e8782edc 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/stats/skills/09300-09399.xml +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/stats/skills/09300-09399.xml @@ -1543,6 +1543,14 @@ P 5 85 + + + + 10 + 15 + + + diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/stats/skills/documentation.txt index 14133e7c78..6158f9486f 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/stats/skills/documentation.txt @@ -111,6 +111,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index 06da9ee495..a25d3414a7 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance) || player.tryLuck(); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/stats/Stat.java index d8790e3e16..62c27673bb 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -188,6 +188,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/EffectMasterHandler.java index 8734287606..938bb474be 100644 --- a/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -141,6 +141,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/stats/skills/09300-09399.xml b/L2J_Mobius_8.0_Homunculus/dist/game/data/stats/skills/09300-09399.xml index 5d0e298462..1d5f3d5316 100644 --- a/L2J_Mobius_8.0_Homunculus/dist/game/data/stats/skills/09300-09399.xml +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/stats/skills/09300-09399.xml @@ -1553,6 +1553,14 @@ P 5 85 + + + + 10 + 15 + + + diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_8.0_Homunculus/dist/game/data/stats/skills/documentation.txt index 14133e7c78..6158f9486f 100644 --- a/L2J_Mobius_8.0_Homunculus/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/stats/skills/documentation.txt @@ -111,6 +111,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index 06da9ee495..a25d3414a7 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance) || player.tryLuck(); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/stats/Stat.java index d8790e3e16..62c27673bb 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -188,6 +188,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java index 2f1d11fc73..e7acd71145 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -131,6 +131,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("DoubleCast", DoubleCast::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java index e5fe3ff12d..100b66b06a 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java @@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler final PlayerInstance player = playable.getActingPlayer(); int level = player.getLevel(); - final int itemLevel = item.getItem().getCrystalType().getId(); + final int itemLevel = item.getItem().getCrystalType().getLevel(); if (level < 20) { level = 0; diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/skills/documentation.txt index 60ed906810..bd3a27cdd2 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/skills/documentation.txt @@ -101,6 +101,7 @@ DispelBySlotProbability: Removes given amount of effects by specified AbnormalTy DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to cast two skills at once. DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 3498400fed..391b37a20c 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2115,7 +2115,7 @@ public class PlayerInstance extends Playable { if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))) { - crystaltype = item.getItem().getCrystalType().getId(); + crystaltype = item.getItem().getCrystalType().getLevel(); if (crystaltype > expertiseLevel) { if (item.isWeapon() && (crystaltype > weaponPenalty)) @@ -8712,7 +8712,7 @@ public class PlayerInstance extends Playable { for (int itemId : _activeSoulShots) { - if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) + if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType) { disableAutoShot(itemId); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 01da5df7a8..8985f2f4ac 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -454,7 +454,7 @@ public abstract class Inventory extends ItemContainer final PlayerInstance player = (PlayerInstance) inventory.getOwner(); // Any items equipped that result in expertise penalty do not give any skills at all. - if (item.getItem().getCrystalType().getId() > player.getExpertiseLevel()) + if (item.getItem().getCrystalType().getLevel() > player.getExpertiseLevel()) { return; } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index bc9f7f7d8a..def60107b5 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java index 868c3b7443..d059efd025 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java @@ -35,14 +35,14 @@ public enum CrystalType R99(10, 17371, 30, 500), EVENT(11, 0, 0, 0); - private final int _id; + private final int _level; private final int _crystalId; private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusWeapon; - CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) + CrystalType(int level, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) { - _id = id; + _level = level; _crystalId = crystalId; _crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; @@ -52,9 +52,9 @@ public enum CrystalType * Gets the crystal type ID. * @return the crystal type ID */ - public int getId() + public int getLevel() { - return _id; + return _level; } /** @@ -78,11 +78,11 @@ public enum CrystalType public boolean isGreater(CrystalType crystalType) { - return getId() > crystalType.getId(); + return getLevel() > crystalType.getLevel(); } public boolean isLesser(CrystalType crystalType) { - return getId() < crystalType.getId(); + return getLevel() < crystalType.getLevel(); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/stats/Stat.java index bf520b0596..118c527732 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -183,6 +183,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java index 8a35a663fa..788f6bf9a1 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java @@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket int newlength = 0; for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { newlength++; } @@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { packet.writeD(product.getItemId()); packet.writeH(product.getItem().getType2()); // item type2 diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/EffectMasterHandler.java index 2f1d11fc73..e7acd71145 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -131,6 +131,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("DoubleCast", DoubleCast::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java index e5fe3ff12d..100b66b06a 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java @@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler final PlayerInstance player = playable.getActingPlayer(); int level = player.getLevel(); - final int itemLevel = item.getItem().getCrystalType().getId(); + final int itemLevel = item.getItem().getCrystalType().getLevel(); if (level < 20) { level = 0; diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/stats/skills/documentation.txt index 60ed906810..bd3a27cdd2 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/stats/skills/documentation.txt @@ -101,6 +101,7 @@ DispelBySlotProbability: Removes given amount of effects by specified AbnormalTy DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to cast two skills at once. DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 104aacfc97..a0917f0cc8 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2115,7 +2115,7 @@ public class PlayerInstance extends Playable { if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))) { - crystaltype = item.getItem().getCrystalType().getId(); + crystaltype = item.getItem().getCrystalType().getLevel(); if (crystaltype > expertiseLevel) { if (item.isWeapon() && (crystaltype > weaponPenalty)) @@ -8712,7 +8712,7 @@ public class PlayerInstance extends Playable { for (int itemId : _activeSoulShots) { - if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) + if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType) { disableAutoShot(itemId); } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 01da5df7a8..8985f2f4ac 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -454,7 +454,7 @@ public abstract class Inventory extends ItemContainer final PlayerInstance player = (PlayerInstance) inventory.getOwner(); // Any items equipped that result in expertise penalty do not give any skills at all. - if (item.getItem().getCrystalType().getId() > player.getExpertiseLevel()) + if (item.getItem().getCrystalType().getLevel() > player.getExpertiseLevel()) { return; } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index bc9f7f7d8a..def60107b5 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java index 868c3b7443..d059efd025 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java @@ -35,14 +35,14 @@ public enum CrystalType R99(10, 17371, 30, 500), EVENT(11, 0, 0, 0); - private final int _id; + private final int _level; private final int _crystalId; private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusWeapon; - CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) + CrystalType(int level, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) { - _id = id; + _level = level; _crystalId = crystalId; _crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; @@ -52,9 +52,9 @@ public enum CrystalType * Gets the crystal type ID. * @return the crystal type ID */ - public int getId() + public int getLevel() { - return _id; + return _level; } /** @@ -78,11 +78,11 @@ public enum CrystalType public boolean isGreater(CrystalType crystalType) { - return getId() > crystalType.getId(); + return getLevel() > crystalType.getLevel(); } public boolean isLesser(CrystalType crystalType) { - return getId() < crystalType.getId(); + return getLevel() < crystalType.getLevel(); } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/stats/Stat.java index bf520b0596..118c527732 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -183,6 +183,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java index 8a35a663fa..788f6bf9a1 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java @@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket int newlength = 0; for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { newlength++; } @@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { packet.writeD(product.getItemId()); packet.writeH(product.getItem().getType2()); // item type2 diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/EffectMasterHandler.java index 8a4a19d2dc..57a86e339e 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -132,6 +132,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("DoubleCast", DoubleCast::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java index e5fe3ff12d..100b66b06a 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java @@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler final PlayerInstance player = playable.getActingPlayer(); int level = player.getLevel(); - final int itemLevel = item.getItem().getCrystalType().getId(); + final int itemLevel = item.getItem().getCrystalType().getLevel(); if (level < 20) { level = 0; diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/stats/skills/documentation.txt index 3f9239f508..10dffeac7a 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/stats/skills/documentation.txt @@ -102,6 +102,7 @@ DispelBySlotProbability: Removes given amount of effects by specified AbnormalTy DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to cast two skills at once. DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index dfec7e2eb2..c6364bc8d7 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2113,7 +2113,7 @@ public class PlayerInstance extends Playable { if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))) { - crystaltype = item.getItem().getCrystalType().getId(); + crystaltype = item.getItem().getCrystalType().getLevel(); if (crystaltype > expertiseLevel) { if (item.isWeapon() && (crystaltype > weaponPenalty)) @@ -8698,7 +8698,7 @@ public class PlayerInstance extends Playable { for (int itemId : _activeSoulShots) { - if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) + if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType) { disableAutoShot(itemId); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 0e8e5372d2..1fa93b0391 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -466,7 +466,7 @@ public abstract class Inventory extends ItemContainer final PlayerInstance player = (PlayerInstance) inventory.getOwner(); // Any items equipped that result in expertise penalty do not give any skills at all. - if (item.getItem().getCrystalType().getId() > player.getExpertiseLevel()) + if (item.getItem().getCrystalType().getLevel() > player.getExpertiseLevel()) { return; } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index bc9f7f7d8a..def60107b5 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java index 868c3b7443..d059efd025 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java @@ -35,14 +35,14 @@ public enum CrystalType R99(10, 17371, 30, 500), EVENT(11, 0, 0, 0); - private final int _id; + private final int _level; private final int _crystalId; private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusWeapon; - CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) + CrystalType(int level, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) { - _id = id; + _level = level; _crystalId = crystalId; _crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; @@ -52,9 +52,9 @@ public enum CrystalType * Gets the crystal type ID. * @return the crystal type ID */ - public int getId() + public int getLevel() { - return _id; + return _level; } /** @@ -78,11 +78,11 @@ public enum CrystalType public boolean isGreater(CrystalType crystalType) { - return getId() > crystalType.getId(); + return getLevel() > crystalType.getLevel(); } public boolean isLesser(CrystalType crystalType) { - return getId() < crystalType.getId(); + return getLevel() < crystalType.getLevel(); } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/stats/Stat.java index 9b5b2482f7..c9480c09ff 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -185,6 +185,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java index 8a35a663fa..788f6bf9a1 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java @@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket int newlength = 0; for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { newlength++; } @@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { packet.writeD(product.getItemId()); packet.writeH(product.getItem().getType2()); // item type2 diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java index fdbe2a8762..31f8e78051 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -135,6 +135,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("ElementalSpiritAttack", ElementalSpiritAttack::new); EffectHandler.getInstance().registerHandler("ElementalSpiritDefense", ElementalSpiritDefense::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java index e5fe3ff12d..100b66b06a 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java @@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler final PlayerInstance player = playable.getActingPlayer(); int level = player.getLevel(); - final int itemLevel = item.getItem().getCrystalType().getId(); + final int itemLevel = item.getItem().getCrystalType().getLevel(); if (level < 20) { level = 0; diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/stats/skills/documentation.txt index 29e13a15f8..7def33e04e 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/stats/skills/documentation.txt @@ -105,6 +105,7 @@ DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) ElementalSpiritAttack: Elemental spirit attack stat effect. (JoeAlisson) ElementalSpiritDefense: Elemental spirit defense stat effect. (JoeAlisson) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 4a2f837608..b4b2807f9a 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2123,7 +2123,7 @@ public class PlayerInstance extends Playable { if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))) { - crystaltype = item.getItem().getCrystalType().getId(); + crystaltype = item.getItem().getCrystalType().getLevel(); if (crystaltype > expertiseLevel) { if (item.isWeapon() && (crystaltype > weaponPenalty)) @@ -8725,7 +8725,7 @@ public class PlayerInstance extends Playable { for (int itemId : _activeSoulShots) { - if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) + if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType) { disableAutoShot(itemId); } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index a7689a13bc..772b8d475f 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -489,7 +489,7 @@ public abstract class Inventory extends ItemContainer final PlayerInstance player = (PlayerInstance) inventory.getOwner(); // Any items equipped that result in expertise penalty do not give any skills at all. - if (item.getItem().getCrystalType().getId() > player.getExpertiseLevel()) + if (item.getItem().getCrystalType().getLevel() > player.getExpertiseLevel()) { return; } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index bc9f7f7d8a..def60107b5 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java index 868c3b7443..d059efd025 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java @@ -35,14 +35,14 @@ public enum CrystalType R99(10, 17371, 30, 500), EVENT(11, 0, 0, 0); - private final int _id; + private final int _level; private final int _crystalId; private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusWeapon; - CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) + CrystalType(int level, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) { - _id = id; + _level = level; _crystalId = crystalId; _crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; @@ -52,9 +52,9 @@ public enum CrystalType * Gets the crystal type ID. * @return the crystal type ID */ - public int getId() + public int getLevel() { - return _id; + return _level; } /** @@ -78,11 +78,11 @@ public enum CrystalType public boolean isGreater(CrystalType crystalType) { - return getId() > crystalType.getId(); + return getLevel() > crystalType.getLevel(); } public boolean isLesser(CrystalType crystalType) { - return getId() < crystalType.getId(); + return getLevel() < crystalType.getLevel(); } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/stats/Stat.java index 510d64f7a9..a89f9d98a7 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -198,6 +198,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java index 8a35a663fa..788f6bf9a1 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java @@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket int newlength = 0; for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { newlength++; } @@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { packet.writeD(product.getItemId()); packet.writeH(product.getItem().getType2()); // item type2 diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java index fdbe2a8762..31f8e78051 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -135,6 +135,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("ElementalSpiritAttack", ElementalSpiritAttack::new); EffectHandler.getInstance().registerHandler("ElementalSpiritDefense", ElementalSpiritDefense::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java index e5fe3ff12d..100b66b06a 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java @@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler final PlayerInstance player = playable.getActingPlayer(); int level = player.getLevel(); - final int itemLevel = item.getItem().getCrystalType().getId(); + final int itemLevel = item.getItem().getCrystalType().getLevel(); if (level < 20) { level = 0; diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/stats/skills/documentation.txt index 29e13a15f8..7def33e04e 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/stats/skills/documentation.txt @@ -105,6 +105,7 @@ DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) ElementalSpiritAttack: Elemental spirit attack stat effect. (JoeAlisson) ElementalSpiritDefense: Elemental spirit defense stat effect. (JoeAlisson) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index a92d49c553..921a92d928 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2123,7 +2123,7 @@ public class PlayerInstance extends Playable { if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))) { - crystaltype = item.getItem().getCrystalType().getId(); + crystaltype = item.getItem().getCrystalType().getLevel(); if (crystaltype > expertiseLevel) { if (item.isWeapon() && (crystaltype > weaponPenalty)) @@ -8725,7 +8725,7 @@ public class PlayerInstance extends Playable { for (int itemId : _activeSoulShots) { - if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) + if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType) { disableAutoShot(itemId); } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index a7689a13bc..772b8d475f 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -489,7 +489,7 @@ public abstract class Inventory extends ItemContainer final PlayerInstance player = (PlayerInstance) inventory.getOwner(); // Any items equipped that result in expertise penalty do not give any skills at all. - if (item.getItem().getCrystalType().getId() > player.getExpertiseLevel()) + if (item.getItem().getCrystalType().getLevel() > player.getExpertiseLevel()) { return; } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index bc9f7f7d8a..def60107b5 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java index 868c3b7443..d059efd025 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java @@ -35,14 +35,14 @@ public enum CrystalType R99(10, 17371, 30, 500), EVENT(11, 0, 0, 0); - private final int _id; + private final int _level; private final int _crystalId; private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusWeapon; - CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) + CrystalType(int level, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) { - _id = id; + _level = level; _crystalId = crystalId; _crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; @@ -52,9 +52,9 @@ public enum CrystalType * Gets the crystal type ID. * @return the crystal type ID */ - public int getId() + public int getLevel() { - return _id; + return _level; } /** @@ -78,11 +78,11 @@ public enum CrystalType public boolean isGreater(CrystalType crystalType) { - return getId() > crystalType.getId(); + return getLevel() > crystalType.getLevel(); } public boolean isLesser(CrystalType crystalType) { - return getId() < crystalType.getId(); + return getLevel() < crystalType.getLevel(); } } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/stats/Stat.java index 510d64f7a9..a89f9d98a7 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -198,6 +198,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java index 8a35a663fa..788f6bf9a1 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java @@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket int newlength = 0; for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { newlength++; } @@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { packet.writeD(product.getItemId()); packet.writeH(product.getItem().getType2()); // item type2 diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java index c259f5eb2b..8a42147633 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -135,6 +135,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("ElementalSpiritAttack", ElementalSpiritAttack::new); EffectHandler.getInstance().registerHandler("ElementalSpiritDefense", ElementalSpiritDefense::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java index e5fe3ff12d..100b66b06a 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java @@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler final PlayerInstance player = playable.getActingPlayer(); int level = player.getLevel(); - final int itemLevel = item.getItem().getCrystalType().getId(); + final int itemLevel = item.getItem().getCrystalType().getLevel(); if (level < 20) { level = 0; diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/documentation.txt index f8884db193..4ae2496d1e 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/documentation.txt @@ -105,6 +105,7 @@ DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) ElementalSpiritAttack: Elemental spirit attack stat effect. (JoeAlisson) ElementalSpiritDefense: Elemental spirit defense stat effect. (JoeAlisson) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index aed7a7df05..fe0b79f5fd 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8668,7 +8668,7 @@ public class PlayerInstance extends Playable { for (int itemId : _activeSoulShots) { - if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) + if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType) { disableAutoShot(itemId); } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index bc9f7f7d8a..def60107b5 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java index 868c3b7443..d059efd025 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java @@ -35,14 +35,14 @@ public enum CrystalType R99(10, 17371, 30, 500), EVENT(11, 0, 0, 0); - private final int _id; + private final int _level; private final int _crystalId; private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusWeapon; - CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) + CrystalType(int level, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) { - _id = id; + _level = level; _crystalId = crystalId; _crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; @@ -52,9 +52,9 @@ public enum CrystalType * Gets the crystal type ID. * @return the crystal type ID */ - public int getId() + public int getLevel() { - return _id; + return _level; } /** @@ -78,11 +78,11 @@ public enum CrystalType public boolean isGreater(CrystalType crystalType) { - return getId() > crystalType.getId(); + return getLevel() > crystalType.getLevel(); } public boolean isLesser(CrystalType crystalType) { - return getId() < crystalType.getId(); + return getLevel() < crystalType.getLevel(); } } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/stats/Stat.java index fc76d61d17..563a5a5b8d 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -200,6 +200,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/EffectMasterHandler.java index f74b919d21..c679ef8a4e 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -133,6 +133,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("DoubleCast", DoubleCast::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/Restoration.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/Restoration.java index 81abe58a8f..90b0cdce78 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/Restoration.java +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/Restoration.java @@ -71,8 +71,8 @@ public class Restoration extends AbstractEffect final Item extractable = ItemTable.getInstance().getTemplate(_itemId); if (extractable != null) { - final int itemCrystalId = extractable.getCrystalType().getId(); - if ((itemCrystalId > Config.MAX_EQUIPABLE_ITEM_GRADE.getId()) && (itemCrystalId < CrystalType.EVENT.getId())) + final int itemCrystalLevel = extractable.getCrystalType().getLevel(); + if ((itemCrystalLevel > Config.MAX_EQUIPABLE_ITEM_GRADE.getLevel()) && (itemCrystalLevel < CrystalType.EVENT.getLevel())) { effected.sendPacket(SystemMessageId.THERE_WAS_NOTHING_FOUND_INSIDE); return; diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/RestorationRandom.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/RestorationRandom.java index fb9e6dd064..856c2b0b6c 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/RestorationRandom.java +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/RestorationRandom.java @@ -116,8 +116,8 @@ public class RestorationRandom extends AbstractEffect final Item extractable = ItemTable.getInstance().getTemplate(createdItem.getId()); if (extractable != null) { - final int itemCrystalId = extractable.getCrystalType().getId(); - if ((itemCrystalId > Config.MAX_EQUIPABLE_ITEM_GRADE.getId()) && (itemCrystalId < CrystalType.EVENT.getId())) + final int itemCrystalLevel = extractable.getCrystalType().getLevel(); + if ((itemCrystalLevel > Config.MAX_EQUIPABLE_ITEM_GRADE.getLevel()) && (itemCrystalLevel < CrystalType.EVENT.getLevel())) { continue; } diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java index e5fe3ff12d..100b66b06a 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java @@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler final PlayerInstance player = playable.getActingPlayer(); int level = player.getLevel(); - final int itemLevel = item.getItem().getCrystalType().getId(); + final int itemLevel = item.getItem().getCrystalType().getLevel(); if (level < 20) { level = 0; diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/ExtractableItems.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/ExtractableItems.java index 8fb01c47de..37bcaec4d9 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/ExtractableItems.java +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/itemhandlers/ExtractableItems.java @@ -210,8 +210,8 @@ public class ExtractableItems implements IItemHandler private void addItem(Map extractedItems, ItemInstance newItem) { // Max equipable item grade configuration. - final int itemCrystalId = newItem.getItem().getCrystalType().getId(); - if ((itemCrystalId > Config.MAX_EQUIPABLE_ITEM_GRADE.getId()) && (itemCrystalId < CrystalType.EVENT.getId())) + final int itemCrystalLevel = newItem.getItem().getCrystalType().getLevel(); + if ((itemCrystalLevel > Config.MAX_EQUIPABLE_ITEM_GRADE.getLevel()) && (itemCrystalLevel < CrystalType.EVENT.getLevel())) { return; } diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_Interlude/dist/game/data/stats/skills/documentation.txt index 814973ad46..8f1f0513c4 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/stats/skills/documentation.txt @@ -103,6 +103,7 @@ DispelBySlotProbability: Removes given amount of effects by specified AbnormalTy DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to cast two skills at once. DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index a744a18127..f9b25fa7f3 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -129,8 +129,8 @@ public class BuyListData implements IXmlReader final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); // Max equipable item grade configuration. - final int itemCrystalId = item.getCrystalType().getId(); - if ((itemCrystalId > Config.MAX_EQUIPABLE_ITEM_GRADE.getId()) && (itemCrystalId < CrystalType.EVENT.getId())) + final int itemCrystalLevel = item.getCrystalType().getLevel(); + if ((itemCrystalLevel > Config.MAX_EQUIPABLE_ITEM_GRADE.getLevel()) && (itemCrystalLevel < CrystalType.EVENT.getLevel())) { break; } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index ded0c69443..f5b4b77935 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -157,8 +157,8 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - final int itemCrystalId = item.getCrystalType().getId(); - if ((itemCrystalId > Config.MAX_EQUIPABLE_ITEM_GRADE.getId()) && (itemCrystalId < CrystalType.EVENT.getId())) + final int itemCrystalLevel = item.getCrystalType().getLevel(); + if ((itemCrystalLevel > Config.MAX_EQUIPABLE_ITEM_GRADE.getLevel()) && (itemCrystalLevel < CrystalType.EVENT.getLevel())) { continue; } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/NpcData.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/NpcData.java index 141832ee9a..27279799a4 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/NpcData.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/NpcData.java @@ -458,8 +458,8 @@ public class NpcData implements IXmlReader else { // Max equipable item grade configuration. - final int itemCrystalId = item.getCrystalType().getId(); - if ((itemCrystalId > Config.MAX_EQUIPABLE_ITEM_GRADE.getId()) && (itemCrystalId < CrystalType.EVENT.getId())) + final int itemCrystalLevel = item.getCrystalType().getLevel(); + if ((itemCrystalLevel > Config.MAX_EQUIPABLE_ITEM_GRADE.getLevel()) && (itemCrystalLevel < CrystalType.EVENT.getLevel())) { continue; } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/RecipeData.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/RecipeData.java index 2c9a90fa04..87af4906ae 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/RecipeData.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/RecipeData.java @@ -181,8 +181,8 @@ public class RecipeData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - final int itemCrystalId = item.getCrystalType().getId(); - if ((itemCrystalId > Config.MAX_EQUIPABLE_ITEM_GRADE.getId()) && (itemCrystalId < CrystalType.EVENT.getId())) + final int itemCrystalLevel = item.getCrystalType().getLevel(); + if ((itemCrystalLevel > Config.MAX_EQUIPABLE_ITEM_GRADE.getLevel()) && (itemCrystalLevel < CrystalType.EVENT.getLevel())) { continue RECIPES_FILE; } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 2020d52e12..b7fc991073 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -2117,7 +2117,7 @@ public class PlayerInstance extends Playable { if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))) { - crystaltype = item.getItem().getCrystalType().getId(); + crystaltype = item.getItem().getCrystalType().getLevel(); if (crystaltype > expertiseLevel) { if (item.isWeapon() && (crystaltype > weaponPenalty)) @@ -8714,7 +8714,7 @@ public class PlayerInstance extends Playable { for (int itemId : _activeSoulShots) { - if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) + if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType) { disableAutoShot(itemId); } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index ba5f6014d8..187cd0e7d2 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -451,7 +451,7 @@ public abstract class Inventory extends ItemContainer final PlayerInstance player = (PlayerInstance) inventory.getOwner(); // Any items equipped that result in expertise penalty do not give any skills at all. - if (item.getItem().getCrystalType().getId() > player.getExpertiseLevel()) + if (item.getItem().getCrystalType().getLevel() > player.getExpertiseLevel()) { return; } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index bc9f7f7d8a..def60107b5 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java index 868c3b7443..d059efd025 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java @@ -35,14 +35,14 @@ public enum CrystalType R99(10, 17371, 30, 500), EVENT(11, 0, 0, 0); - private final int _id; + private final int _level; private final int _crystalId; private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusWeapon; - CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) + CrystalType(int level, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) { - _id = id; + _level = level; _crystalId = crystalId; _crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; @@ -52,9 +52,9 @@ public enum CrystalType * Gets the crystal type ID. * @return the crystal type ID */ - public int getId() + public int getLevel() { - return _id; + return _level; } /** @@ -78,11 +78,11 @@ public enum CrystalType public boolean isGreater(CrystalType crystalType) { - return getId() > crystalType.getId(); + return getLevel() > crystalType.getLevel(); } public boolean isLesser(CrystalType crystalType) { - return getId() < crystalType.getId(); + return getLevel() < crystalType.getLevel(); } } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/stats/Stat.java index 39806ebbfb..598a3d315f 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -185,6 +185,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"), diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java index 769f54a627..40087d2e89 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -181,8 +181,8 @@ public class UseItem implements IClientIncomingPacket if (item.isEquipable()) { // Max equipable item grade configuration. - final int itemCrystalId = item.getItem().getCrystalType().getId(); - if (!player.isGM() && (itemCrystalId > Config.MAX_EQUIPABLE_ITEM_GRADE.getId()) && (itemCrystalId < CrystalType.EVENT.getId())) + final int itemCrystalLevel = item.getItem().getCrystalType().getLevel(); + if (!player.isGM() && (itemCrystalLevel > Config.MAX_EQUIPABLE_ITEM_GRADE.getLevel()) && (itemCrystalLevel < CrystalType.EVENT.getLevel())) { return; } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java index 8a35a663fa..788f6bf9a1 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/ShopPreviewList.java @@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket int newlength = 0; for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { newlength++; } @@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket for (Product product : _list) { - if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) + if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable()) { packet.writeD(product.getItemId()); packet.writeH(product.getItem().getType2()); // item type2 diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java index cf93fb563b..72bf1e837d 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -135,6 +135,7 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("ElementalSpiritAttack", ElementalSpiritAttack::new); EffectHandler.getInstance().registerHandler("ElementalSpiritDefense", ElementalSpiritDefense::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); + EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java new file mode 100644 index 0000000000..f3112dd873 --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/EnchantRate.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.effecthandlers; + +import org.l2jmobius.gameserver.model.StatSet; +import org.l2jmobius.gameserver.model.stats.Stat; + +/** + * @author zarco + */ +public class EnchantRate extends AbstractStatAddEffect +{ + public EnchantRate(StatSet params) + { + super(params, Stat.ENCHANT_RATE); + } +} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java index e5fe3ff12d..100b66b06a 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/CharmOfCourage.java @@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler final PlayerInstance player = playable.getActingPlayer(); int level = player.getLevel(); - final int itemLevel = item.getItem().getCrystalType().getId(); + final int itemLevel = item.getItem().getCrystalType().getLevel(); if (level < 20) { level = 0; diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt index e1f4788942..ac49d3b5b9 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt @@ -105,6 +105,7 @@ DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) ElementalSpiritAttack: Elemental spirit attack stat effect. (JoeAlisson) ElementalSpiritDefense: Elemental spirit defense stat effect. (JoeAlisson) EnableCloak: See/unsee cloaks. +EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius) EnemyCharge: Charges towards the enemy. Rush Impact. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnlargeAbnormalSlot: Increase the amount of buff slots. diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index e1d5d004be..9965702b5b 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8753,7 +8753,7 @@ public class PlayerInstance extends Playable { for (int itemId : _activeSoulShots) { - if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) + if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType) { disableAutoShot(itemId); } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java index bc9f7f7d8a..def60107b5 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/enchant/EnchantScroll.java @@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.items.type.CrystalType; import org.l2jmobius.gameserver.model.items.type.EtcItemType; import org.l2jmobius.gameserver.model.items.type.ItemType; +import org.l2jmobius.gameserver.model.stats.Stat; /** * @author UnAfraid @@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem return EnchantResultType.ERROR; } + final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel(); + final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0; final double bonusRate = getBonusRate(); final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; - final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100); + final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100); final double random = 100 * Rnd.nextDouble(); final boolean success = (random < finalChance); return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java index 868c3b7443..d059efd025 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/type/CrystalType.java @@ -35,14 +35,14 @@ public enum CrystalType R99(10, 17371, 30, 500), EVENT(11, 0, 0, 0); - private final int _id; + private final int _level; private final int _crystalId; private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusWeapon; - CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) + CrystalType(int level, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) { - _id = id; + _level = level; _crystalId = crystalId; _crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; @@ -52,9 +52,9 @@ public enum CrystalType * Gets the crystal type ID. * @return the crystal type ID */ - public int getId() + public int getLevel() { - return _id; + return _level; } /** @@ -78,11 +78,11 @@ public enum CrystalType public boolean isGreater(CrystalType crystalType) { - return getId() > crystalType.getId(); + return getLevel() > crystalType.getLevel(); } public boolean isLesser(CrystalType crystalType) { - return getId() < crystalType.getId(); + return getLevel() < crystalType.getLevel(); } } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/stats/Stat.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/stats/Stat.java index 6d3d1fd51c..9b7faf74bc 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/stats/Stat.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/stats/Stat.java @@ -200,6 +200,7 @@ public enum Stat BREATH("breath"), FALL("fall"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"), + ENCHANT_RATE("enchantRate"), // VULNERABILITIES DAMAGE_ZONE_VULN("damageZoneVuln"),