Addition of EnchantRate effect handler.

Contributed by facab.
This commit is contained in:
MobiusDevelopment
2021-01-21 23:18:45 +00:00
parent c2517b754f
commit a83b7b4c62
153 changed files with 886 additions and 168 deletions
@@ -134,6 +134,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new);
EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new);
EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new);
EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new);
EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new);
EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new);
EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new);
@@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}
@@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler
final PlayerInstance player = playable.getActingPlayer(); final PlayerInstance player = playable.getActingPlayer();
int level = player.getLevel(); int level = player.getLevel();
final int itemLevel = item.getItem().getCrystalType().getId(); final int itemLevel = item.getItem().getCrystalType().getLevel();
if (level < 20) if (level < 20)
{ {
level = 0; level = 0;
@@ -1542,6 +1542,14 @@
<operateType>P</operateType> <operateType>P</operateType>
<magicCriticalRate>5</magicCriticalRate> <magicCriticalRate>5</magicCriticalRate>
<magicLevel>85</magicLevel> <magicLevel>85</magicLevel>
<effects>
<effect name="EnchantRate">
<amount>
<value level="1">10</value>
<value level="2">15</value>
</amount>
</effect>
</effects>
</skill> </skill>
<skill id="9371" toLevel="1" name="Sayha's Portal"> <skill id="9371" toLevel="1" name="Sayha's Portal">
<!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. --> <!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. -->
@@ -104,6 +104,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to
DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius)
DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius)
EnableCloak: See/unsee cloaks. EnableCloak: See/unsee cloaks.
EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius)
EnemyCharge: Charges towards the enemy. Rush Impact. EnemyCharge: Charges towards the enemy. Rush Impact.
EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc.
EnlargeAbnormalSlot: Increase the amount of buff slots. EnlargeAbnormalSlot: Increase the amount of buff slots.
@@ -2151,7 +2151,7 @@ public class PlayerInstance extends Playable
{ {
if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))) 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 (crystaltype > expertiseLevel)
{ {
if (item.isWeapon() && (crystaltype > weaponPenalty)) if (item.isWeapon() && (crystaltype > weaponPenalty))
@@ -8825,7 +8825,7 @@ public class PlayerInstance extends Playable
{ {
for (int itemId : _activeSoulShots) for (int itemId : _activeSoulShots)
{ {
if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType)
{ {
disableAutoShot(itemId); disableAutoShot(itemId);
} }
@@ -451,7 +451,7 @@ public abstract class Inventory extends ItemContainer
final PlayerInstance player = (PlayerInstance) inventory.getOwner(); final PlayerInstance player = (PlayerInstance) inventory.getOwner();
// Any items equipped that result in expertise penalty do not give any skills at all. // 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; return;
} }
@@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance; 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.EtcItemType;
import org.l2jmobius.gameserver.model.items.type.ItemType; import org.l2jmobius.gameserver.model.items.type.ItemType;
import org.l2jmobius.gameserver.model.stats.Stat;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem
return EnchantResultType.ERROR; 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 bonusRate = getBonusRate();
final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; 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 double random = 100 * Rnd.nextDouble();
final boolean success = (random < finalChance) || player.tryLuck(); final boolean success = (random < finalChance) || player.tryLuck();
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
@@ -35,14 +35,14 @@ public enum CrystalType
R99(10, 17371, 30, 500), R99(10, 17371, 30, 500),
EVENT(11, 0, 0, 0); EVENT(11, 0, 0, 0);
private final int _id; private final int _level;
private final int _crystalId; private final int _crystalId;
private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusArmor;
private final int _crystalEnchantBonusWeapon; 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; _crystalId = crystalId;
_crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusArmor = crystalEnchantBonusArmor;
_crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon;
@@ -52,9 +52,9 @@ public enum CrystalType
* Gets the crystal type ID. * Gets the crystal type ID.
* @return 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) public boolean isGreater(CrystalType crystalType)
{ {
return getId() > crystalType.getId(); return getLevel() > crystalType.getLevel();
} }
public boolean isLesser(CrystalType crystalType) public boolean isLesser(CrystalType crystalType)
{ {
return getId() < crystalType.getId(); return getLevel() < crystalType.getLevel();
} }
} }
@@ -186,6 +186,7 @@ public enum Stat
BREATH("breath"), BREATH("breath"),
FALL("fall"), FALL("fall"),
FISHING_EXP_SP_BONUS("fishingExpSpBonus"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"),
ENCHANT_RATE("enchantRate"),
// VULNERABILITIES // VULNERABILITIES
DAMAGE_ZONE_VULN("damageZoneVuln"), DAMAGE_ZONE_VULN("damageZoneVuln"),
@@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
int newlength = 0; int newlength = 0;
for (Product product : _list) for (Product product : _list)
{ {
if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable())
{ {
newlength++; newlength++;
} }
@@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
for (Product product : _list) 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.writeD(product.getItemId());
packet.writeH(product.getItem().getType2()); // item type2 packet.writeH(product.getItem().getType2()); // item type2
@@ -134,6 +134,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new);
EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new);
EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new);
EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new);
EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new);
EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new);
EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new);
@@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}
@@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler
final PlayerInstance player = playable.getActingPlayer(); final PlayerInstance player = playable.getActingPlayer();
int level = player.getLevel(); int level = player.getLevel();
final int itemLevel = item.getItem().getCrystalType().getId(); final int itemLevel = item.getItem().getCrystalType().getLevel();
if (level < 20) if (level < 20)
{ {
level = 0; level = 0;
@@ -1542,6 +1542,14 @@
<operateType>P</operateType> <operateType>P</operateType>
<magicCriticalRate>5</magicCriticalRate> <magicCriticalRate>5</magicCriticalRate>
<magicLevel>85</magicLevel> <magicLevel>85</magicLevel>
<effects>
<effect name="EnchantRate">
<amount>
<value level="1">10</value>
<value level="2">15</value>
</amount>
</effect>
</effects>
</skill> </skill>
<skill id="9371" toLevel="1" name="Sayha's Portal"> <skill id="9371" toLevel="1" name="Sayha's Portal">
<!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. --> <!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. -->
@@ -104,6 +104,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to
DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius)
DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius)
EnableCloak: See/unsee cloaks. EnableCloak: See/unsee cloaks.
EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius)
EnemyCharge: Charges towards the enemy. Rush Impact. EnemyCharge: Charges towards the enemy. Rush Impact.
EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc.
EnlargeAbnormalSlot: Increase the amount of buff slots. EnlargeAbnormalSlot: Increase the amount of buff slots.
@@ -2157,7 +2157,7 @@ public class PlayerInstance extends Playable
{ {
if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))) 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 (crystaltype > expertiseLevel)
{ {
if (item.isWeapon() && (crystaltype > weaponPenalty)) if (item.isWeapon() && (crystaltype > weaponPenalty))
@@ -8832,7 +8832,7 @@ public class PlayerInstance extends Playable
{ {
for (int itemId : _activeSoulShots) for (int itemId : _activeSoulShots)
{ {
if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType)
{ {
disableAutoShot(itemId); disableAutoShot(itemId);
} }
@@ -454,7 +454,7 @@ public abstract class Inventory extends ItemContainer
final PlayerInstance player = (PlayerInstance) inventory.getOwner(); final PlayerInstance player = (PlayerInstance) inventory.getOwner();
// Any items equipped that result in expertise penalty do not give any skills at all. // 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; return;
} }
@@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance; 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.EtcItemType;
import org.l2jmobius.gameserver.model.items.type.ItemType; import org.l2jmobius.gameserver.model.items.type.ItemType;
import org.l2jmobius.gameserver.model.stats.Stat;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem
return EnchantResultType.ERROR; 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 bonusRate = getBonusRate();
final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; 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 double random = 100 * Rnd.nextDouble();
final boolean success = (random < finalChance) || player.tryLuck(); final boolean success = (random < finalChance) || player.tryLuck();
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
@@ -35,14 +35,14 @@ public enum CrystalType
R99(10, 17371, 30, 500), R99(10, 17371, 30, 500),
EVENT(11, 0, 0, 0); EVENT(11, 0, 0, 0);
private final int _id; private final int _level;
private final int _crystalId; private final int _crystalId;
private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusArmor;
private final int _crystalEnchantBonusWeapon; 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; _crystalId = crystalId;
_crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusArmor = crystalEnchantBonusArmor;
_crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon;
@@ -52,9 +52,9 @@ public enum CrystalType
* Gets the crystal type ID. * Gets the crystal type ID.
* @return 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) public boolean isGreater(CrystalType crystalType)
{ {
return getId() > crystalType.getId(); return getLevel() > crystalType.getLevel();
} }
public boolean isLesser(CrystalType crystalType) public boolean isLesser(CrystalType crystalType)
{ {
return getId() < crystalType.getId(); return getLevel() < crystalType.getLevel();
} }
} }
@@ -186,6 +186,7 @@ public enum Stat
BREATH("breath"), BREATH("breath"),
FALL("fall"), FALL("fall"),
FISHING_EXP_SP_BONUS("fishingExpSpBonus"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"),
ENCHANT_RATE("enchantRate"),
// VULNERABILITIES // VULNERABILITIES
DAMAGE_ZONE_VULN("damageZoneVuln"), DAMAGE_ZONE_VULN("damageZoneVuln"),
@@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
int newlength = 0; int newlength = 0;
for (Product product : _list) for (Product product : _list)
{ {
if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable())
{ {
newlength++; newlength++;
} }
@@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
for (Product product : _list) 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.writeD(product.getItemId());
packet.writeH(product.getItem().getType2()); // item type2 packet.writeH(product.getItem().getType2()); // item type2
@@ -134,6 +134,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new);
EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new);
EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new);
EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new);
EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new);
EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new);
EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new);
@@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}
@@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler
final PlayerInstance player = playable.getActingPlayer(); final PlayerInstance player = playable.getActingPlayer();
int level = player.getLevel(); int level = player.getLevel();
final int itemLevel = item.getItem().getCrystalType().getId(); final int itemLevel = item.getItem().getCrystalType().getLevel();
if (level < 20) if (level < 20)
{ {
level = 0; level = 0;
@@ -1542,6 +1542,14 @@
<operateType>P</operateType> <operateType>P</operateType>
<magicCriticalRate>5</magicCriticalRate> <magicCriticalRate>5</magicCriticalRate>
<magicLevel>85</magicLevel> <magicLevel>85</magicLevel>
<effects>
<effect name="EnchantRate">
<amount>
<value level="1">10</value>
<value level="2">15</value>
</amount>
</effect>
</effects>
</skill> </skill>
<skill id="9371" toLevel="1" name="Sayha's Portal"> <skill id="9371" toLevel="1" name="Sayha's Portal">
<!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. --> <!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. -->
@@ -104,6 +104,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to
DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius)
DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius)
EnableCloak: See/unsee cloaks. EnableCloak: See/unsee cloaks.
EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius)
EnemyCharge: Charges towards the enemy. Rush Impact. EnemyCharge: Charges towards the enemy. Rush Impact.
EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc.
EnlargeAbnormalSlot: Increase the amount of buff slots. EnlargeAbnormalSlot: Increase the amount of buff slots.
@@ -2159,7 +2159,7 @@ public class PlayerInstance extends Playable
{ {
if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))) 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 (crystaltype > expertiseLevel)
{ {
if (item.isWeapon() && (crystaltype > weaponPenalty)) if (item.isWeapon() && (crystaltype > weaponPenalty))
@@ -8834,7 +8834,7 @@ public class PlayerInstance extends Playable
{ {
for (int itemId : _activeSoulShots) for (int itemId : _activeSoulShots)
{ {
if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType)
{ {
disableAutoShot(itemId); disableAutoShot(itemId);
} }
@@ -454,7 +454,7 @@ public abstract class Inventory extends ItemContainer
final PlayerInstance player = (PlayerInstance) inventory.getOwner(); final PlayerInstance player = (PlayerInstance) inventory.getOwner();
// Any items equipped that result in expertise penalty do not give any skills at all. // 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; return;
} }
@@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance; 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.EtcItemType;
import org.l2jmobius.gameserver.model.items.type.ItemType; import org.l2jmobius.gameserver.model.items.type.ItemType;
import org.l2jmobius.gameserver.model.stats.Stat;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem
return EnchantResultType.ERROR; 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 bonusRate = getBonusRate();
final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; 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 double random = 100 * Rnd.nextDouble();
final boolean success = (random < finalChance) || player.tryLuck(); final boolean success = (random < finalChance) || player.tryLuck();
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
@@ -35,14 +35,14 @@ public enum CrystalType
R99(10, 17371, 30, 500), R99(10, 17371, 30, 500),
EVENT(11, 0, 0, 0); EVENT(11, 0, 0, 0);
private final int _id; private final int _level;
private final int _crystalId; private final int _crystalId;
private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusArmor;
private final int _crystalEnchantBonusWeapon; 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; _crystalId = crystalId;
_crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusArmor = crystalEnchantBonusArmor;
_crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon;
@@ -52,9 +52,9 @@ public enum CrystalType
* Gets the crystal type ID. * Gets the crystal type ID.
* @return 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) public boolean isGreater(CrystalType crystalType)
{ {
return getId() > crystalType.getId(); return getLevel() > crystalType.getLevel();
} }
public boolean isLesser(CrystalType crystalType) public boolean isLesser(CrystalType crystalType)
{ {
return getId() < crystalType.getId(); return getLevel() < crystalType.getLevel();
} }
} }
@@ -186,6 +186,7 @@ public enum Stat
BREATH("breath"), BREATH("breath"),
FALL("fall"), FALL("fall"),
FISHING_EXP_SP_BONUS("fishingExpSpBonus"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"),
ENCHANT_RATE("enchantRate"),
// VULNERABILITIES // VULNERABILITIES
DAMAGE_ZONE_VULN("damageZoneVuln"), DAMAGE_ZONE_VULN("damageZoneVuln"),
@@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
int newlength = 0; int newlength = 0;
for (Product product : _list) for (Product product : _list)
{ {
if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable())
{ {
newlength++; newlength++;
} }
@@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
for (Product product : _list) 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.writeD(product.getItemId());
packet.writeH(product.getItem().getType2()); // item type2 packet.writeH(product.getItem().getType2()); // item type2
@@ -138,6 +138,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new);
EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new);
EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new);
EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new);
EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new);
EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new);
EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new);
@@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}
@@ -1542,6 +1542,14 @@
<operateType>P</operateType> <operateType>P</operateType>
<magicCriticalRate>5</magicCriticalRate> <magicCriticalRate>5</magicCriticalRate>
<magicLevel>85</magicLevel> <magicLevel>85</magicLevel>
<effects>
<effect name="EnchantRate">
<amount>
<value level="1">10</value>
<value level="2">15</value>
</amount>
</effect>
</effects>
</skill> </skill>
<skill id="9371" toLevel="1" name="Sayha's Portal"> <skill id="9371" toLevel="1" name="Sayha's Portal">
<!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. --> <!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. -->
@@ -108,6 +108,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to
DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius)
DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius)
EnableCloak: See/unsee cloaks. EnableCloak: See/unsee cloaks.
EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius)
EnemyCharge: Charges towards the enemy. Rush Impact. EnemyCharge: Charges towards the enemy. Rush Impact.
EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc.
EnlargeAbnormalSlot: Increase the amount of buff slots. EnlargeAbnormalSlot: Increase the amount of buff slots.
@@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance; 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.EtcItemType;
import org.l2jmobius.gameserver.model.items.type.ItemType; import org.l2jmobius.gameserver.model.items.type.ItemType;
import org.l2jmobius.gameserver.model.stats.Stat;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem
return EnchantResultType.ERROR; 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 bonusRate = getBonusRate();
final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; 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 double random = 100 * Rnd.nextDouble();
final boolean success = (random < finalChance) || player.tryLuck(); final boolean success = (random < finalChance) || player.tryLuck();
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
@@ -186,6 +186,7 @@ public enum Stat
BREATH("breath"), BREATH("breath"),
FALL("fall"), FALL("fall"),
FISHING_EXP_SP_BONUS("fishingExpSpBonus"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"),
ENCHANT_RATE("enchantRate"),
// VULNERABILITIES // VULNERABILITIES
DAMAGE_ZONE_VULN("damageZoneVuln"), DAMAGE_ZONE_VULN("damageZoneVuln"),
@@ -140,6 +140,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new);
EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new);
EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new);
EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new);
EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new);
EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new);
EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new);
@@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}
@@ -1542,6 +1542,14 @@
<operateType>P</operateType> <operateType>P</operateType>
<magicCriticalRate>5</magicCriticalRate> <magicCriticalRate>5</magicCriticalRate>
<magicLevel>85</magicLevel> <magicLevel>85</magicLevel>
<effects>
<effect name="EnchantRate">
<amount>
<value level="1">10</value>
<value level="2">15</value>
</amount>
</effect>
</effects>
</skill> </skill>
<skill id="9371" toLevel="1" name="Sayha's Portal"> <skill id="9371" toLevel="1" name="Sayha's Portal">
<!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. --> <!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. -->
@@ -110,6 +110,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to
DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius)
DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius)
EnableCloak: See/unsee cloaks. EnableCloak: See/unsee cloaks.
EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius)
EnemyCharge: Charges towards the enemy. Rush Impact. EnemyCharge: Charges towards the enemy. Rush Impact.
EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc.
EnlargeAbnormalSlot: Increase the amount of buff slots. EnlargeAbnormalSlot: Increase the amount of buff slots.
@@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance; 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.EtcItemType;
import org.l2jmobius.gameserver.model.items.type.ItemType; import org.l2jmobius.gameserver.model.items.type.ItemType;
import org.l2jmobius.gameserver.model.stats.Stat;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem
return EnchantResultType.ERROR; 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 bonusRate = getBonusRate();
final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; 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 double random = 100 * Rnd.nextDouble();
final boolean success = (random < finalChance) || player.tryLuck(); final boolean success = (random < finalChance) || player.tryLuck();
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
@@ -188,6 +188,7 @@ public enum Stat
BREATH("breath"), BREATH("breath"),
FALL("fall"), FALL("fall"),
FISHING_EXP_SP_BONUS("fishingExpSpBonus"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"),
ENCHANT_RATE("enchantRate"),
// VULNERABILITIES // VULNERABILITIES
DAMAGE_ZONE_VULN("damageZoneVuln"), DAMAGE_ZONE_VULN("damageZoneVuln"),
@@ -141,6 +141,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new);
EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new);
EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new);
EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new);
EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new);
EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new);
EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new);
@@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}
@@ -1543,6 +1543,14 @@
<operateType>P</operateType> <operateType>P</operateType>
<magicCriticalRate>5</magicCriticalRate> <magicCriticalRate>5</magicCriticalRate>
<magicLevel>85</magicLevel> <magicLevel>85</magicLevel>
<effects>
<effect name="EnchantRate">
<amount>
<value level="1">10</value>
<value level="2">15</value>
</amount>
</effect>
</effects>
</skill> </skill>
<skill id="9371" toLevel="1" name="Sayha's Portal"> <skill id="9371" toLevel="1" name="Sayha's Portal">
<!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. --> <!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. -->
@@ -111,6 +111,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to
DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius)
DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius)
EnableCloak: See/unsee cloaks. EnableCloak: See/unsee cloaks.
EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius)
EnemyCharge: Charges towards the enemy. Rush Impact. EnemyCharge: Charges towards the enemy. Rush Impact.
EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc.
EnlargeAbnormalSlot: Increase the amount of buff slots. EnlargeAbnormalSlot: Increase the amount of buff slots.
@@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance; 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.EtcItemType;
import org.l2jmobius.gameserver.model.items.type.ItemType; import org.l2jmobius.gameserver.model.items.type.ItemType;
import org.l2jmobius.gameserver.model.stats.Stat;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem
return EnchantResultType.ERROR; 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 bonusRate = getBonusRate();
final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; 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 double random = 100 * Rnd.nextDouble();
final boolean success = (random < finalChance) || player.tryLuck(); final boolean success = (random < finalChance) || player.tryLuck();
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
@@ -188,6 +188,7 @@ public enum Stat
BREATH("breath"), BREATH("breath"),
FALL("fall"), FALL("fall"),
FISHING_EXP_SP_BONUS("fishingExpSpBonus"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"),
ENCHANT_RATE("enchantRate"),
// VULNERABILITIES // VULNERABILITIES
DAMAGE_ZONE_VULN("damageZoneVuln"), DAMAGE_ZONE_VULN("damageZoneVuln"),
@@ -141,6 +141,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new);
EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new);
EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new);
EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new);
EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new);
EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new);
EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new);
@@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}
@@ -1543,6 +1543,14 @@
<operateType>P</operateType> <operateType>P</operateType>
<magicCriticalRate>5</magicCriticalRate> <magicCriticalRate>5</magicCriticalRate>
<magicLevel>85</magicLevel> <magicLevel>85</magicLevel>
<effects>
<effect name="EnchantRate">
<amount>
<value level="1">10</value>
<value level="2">15</value>
</amount>
</effect>
</effects>
</skill> </skill>
<skill id="9371" toLevel="1" name="Sayha's Portal"> <skill id="9371" toLevel="1" name="Sayha's Portal">
<!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. --> <!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. -->
@@ -111,6 +111,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to
DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius)
DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius)
EnableCloak: See/unsee cloaks. EnableCloak: See/unsee cloaks.
EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius)
EnemyCharge: Charges towards the enemy. Rush Impact. EnemyCharge: Charges towards the enemy. Rush Impact.
EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc.
EnlargeAbnormalSlot: Increase the amount of buff slots. EnlargeAbnormalSlot: Increase the amount of buff slots.
@@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance; 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.EtcItemType;
import org.l2jmobius.gameserver.model.items.type.ItemType; import org.l2jmobius.gameserver.model.items.type.ItemType;
import org.l2jmobius.gameserver.model.stats.Stat;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem
return EnchantResultType.ERROR; 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 bonusRate = getBonusRate();
final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; 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 double random = 100 * Rnd.nextDouble();
final boolean success = (random < finalChance) || player.tryLuck(); final boolean success = (random < finalChance) || player.tryLuck();
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
@@ -188,6 +188,7 @@ public enum Stat
BREATH("breath"), BREATH("breath"),
FALL("fall"), FALL("fall"),
FISHING_EXP_SP_BONUS("fishingExpSpBonus"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"),
ENCHANT_RATE("enchantRate"),
// VULNERABILITIES // VULNERABILITIES
DAMAGE_ZONE_VULN("damageZoneVuln"), DAMAGE_ZONE_VULN("damageZoneVuln"),
@@ -141,6 +141,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new);
EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new);
EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new);
EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new);
EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new);
EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new);
EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new);
@@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}
@@ -1543,6 +1543,14 @@
<operateType>P</operateType> <operateType>P</operateType>
<magicCriticalRate>5</magicCriticalRate> <magicCriticalRate>5</magicCriticalRate>
<magicLevel>85</magicLevel> <magicLevel>85</magicLevel>
<effects>
<effect name="EnchantRate">
<amount>
<value level="1">10</value>
<value level="2">15</value>
</amount>
</effect>
</effects>
</skill> </skill>
<skill id="9371" toLevel="1" name="Sayha's Portal"> <skill id="9371" toLevel="1" name="Sayha's Portal">
<!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. --> <!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. -->
@@ -111,6 +111,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to
DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius)
DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius)
EnableCloak: See/unsee cloaks. EnableCloak: See/unsee cloaks.
EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius)
EnemyCharge: Charges towards the enemy. Rush Impact. EnemyCharge: Charges towards the enemy. Rush Impact.
EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc.
EnlargeAbnormalSlot: Increase the amount of buff slots. EnlargeAbnormalSlot: Increase the amount of buff slots.
@@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance; 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.EtcItemType;
import org.l2jmobius.gameserver.model.items.type.ItemType; import org.l2jmobius.gameserver.model.items.type.ItemType;
import org.l2jmobius.gameserver.model.stats.Stat;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem
return EnchantResultType.ERROR; 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 bonusRate = getBonusRate();
final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; 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 double random = 100 * Rnd.nextDouble();
final boolean success = (random < finalChance) || player.tryLuck(); final boolean success = (random < finalChance) || player.tryLuck();
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
@@ -188,6 +188,7 @@ public enum Stat
BREATH("breath"), BREATH("breath"),
FALL("fall"), FALL("fall"),
FISHING_EXP_SP_BONUS("fishingExpSpBonus"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"),
ENCHANT_RATE("enchantRate"),
// VULNERABILITIES // VULNERABILITIES
DAMAGE_ZONE_VULN("damageZoneVuln"), DAMAGE_ZONE_VULN("damageZoneVuln"),
@@ -141,6 +141,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new); EffectHandler.getInstance().registerHandler("DragonWeaponDefence", DragonWeaponDefence::new);
EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new);
EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new);
EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new);
EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new);
EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new);
EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new);
@@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}
@@ -1553,6 +1553,14 @@
<operateType>P</operateType> <operateType>P</operateType>
<magicCriticalRate>5</magicCriticalRate> <magicCriticalRate>5</magicCriticalRate>
<magicLevel>85</magicLevel> <magicLevel>85</magicLevel>
<effects>
<effect name="EnchantRate">
<amount>
<value level="1">10</value>
<value level="2">15</value>
</amount>
</effect>
</effects>
</skill> </skill>
<skill id="9371" toLevel="1" name="Sayha's Portal"> <skill id="9371" toLevel="1" name="Sayha's Portal">
<!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. --> <!-- Summons a portal that stays for 5 min. Cannot be used in special places like the GM Consultation Services. -->
@@ -111,6 +111,7 @@ DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to
DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius) DragonWeaponDefence: Dragon weapon defence stat. (l2jmobius)
DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius)
EnableCloak: See/unsee cloaks. EnableCloak: See/unsee cloaks.
EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius)
EnemyCharge: Charges towards the enemy. Rush Impact. EnemyCharge: Charges towards the enemy. Rush Impact.
EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc.
EnlargeAbnormalSlot: Increase the amount of buff slots. EnlargeAbnormalSlot: Increase the amount of buff slots.
@@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance; 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.EtcItemType;
import org.l2jmobius.gameserver.model.items.type.ItemType; import org.l2jmobius.gameserver.model.items.type.ItemType;
import org.l2jmobius.gameserver.model.stats.Stat;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem
return EnchantResultType.ERROR; 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 bonusRate = getBonusRate();
final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; 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 double random = 100 * Rnd.nextDouble();
final boolean success = (random < finalChance) || player.tryLuck(); final boolean success = (random < finalChance) || player.tryLuck();
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
@@ -188,6 +188,7 @@ public enum Stat
BREATH("breath"), BREATH("breath"),
FALL("fall"), FALL("fall"),
FISHING_EXP_SP_BONUS("fishingExpSpBonus"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"),
ENCHANT_RATE("enchantRate"),
// VULNERABILITIES // VULNERABILITIES
DAMAGE_ZONE_VULN("damageZoneVuln"), DAMAGE_ZONE_VULN("damageZoneVuln"),
@@ -131,6 +131,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("DoubleCast", DoubleCast::new); EffectHandler.getInstance().registerHandler("DoubleCast", DoubleCast::new);
EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new);
EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new);
EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new);
EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new);
EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new);
EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new);
@@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}
@@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler
final PlayerInstance player = playable.getActingPlayer(); final PlayerInstance player = playable.getActingPlayer();
int level = player.getLevel(); int level = player.getLevel();
final int itemLevel = item.getItem().getCrystalType().getId(); final int itemLevel = item.getItem().getCrystalType().getLevel();
if (level < 20) if (level < 20)
{ {
level = 0; level = 0;
@@ -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. DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to cast two skills at once.
DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius)
EnableCloak: See/unsee cloaks. EnableCloak: See/unsee cloaks.
EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius)
EnemyCharge: Charges towards the enemy. Rush Impact. EnemyCharge: Charges towards the enemy. Rush Impact.
EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc.
EnlargeAbnormalSlot: Increase the amount of buff slots. EnlargeAbnormalSlot: Increase the amount of buff slots.
@@ -2115,7 +2115,7 @@ public class PlayerInstance extends Playable
{ {
if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))) 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 (crystaltype > expertiseLevel)
{ {
if (item.isWeapon() && (crystaltype > weaponPenalty)) if (item.isWeapon() && (crystaltype > weaponPenalty))
@@ -8712,7 +8712,7 @@ public class PlayerInstance extends Playable
{ {
for (int itemId : _activeSoulShots) for (int itemId : _activeSoulShots)
{ {
if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType)
{ {
disableAutoShot(itemId); disableAutoShot(itemId);
} }
@@ -454,7 +454,7 @@ public abstract class Inventory extends ItemContainer
final PlayerInstance player = (PlayerInstance) inventory.getOwner(); final PlayerInstance player = (PlayerInstance) inventory.getOwner();
// Any items equipped that result in expertise penalty do not give any skills at all. // 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; return;
} }
@@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance; 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.EtcItemType;
import org.l2jmobius.gameserver.model.items.type.ItemType; import org.l2jmobius.gameserver.model.items.type.ItemType;
import org.l2jmobius.gameserver.model.stats.Stat;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem
return EnchantResultType.ERROR; 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 bonusRate = getBonusRate();
final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; 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 double random = 100 * Rnd.nextDouble();
final boolean success = (random < finalChance); final boolean success = (random < finalChance);
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
@@ -35,14 +35,14 @@ public enum CrystalType
R99(10, 17371, 30, 500), R99(10, 17371, 30, 500),
EVENT(11, 0, 0, 0); EVENT(11, 0, 0, 0);
private final int _id; private final int _level;
private final int _crystalId; private final int _crystalId;
private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusArmor;
private final int _crystalEnchantBonusWeapon; 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; _crystalId = crystalId;
_crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusArmor = crystalEnchantBonusArmor;
_crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon;
@@ -52,9 +52,9 @@ public enum CrystalType
* Gets the crystal type ID. * Gets the crystal type ID.
* @return 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) public boolean isGreater(CrystalType crystalType)
{ {
return getId() > crystalType.getId(); return getLevel() > crystalType.getLevel();
} }
public boolean isLesser(CrystalType crystalType) public boolean isLesser(CrystalType crystalType)
{ {
return getId() < crystalType.getId(); return getLevel() < crystalType.getLevel();
} }
} }
@@ -183,6 +183,7 @@ public enum Stat
BREATH("breath"), BREATH("breath"),
FALL("fall"), FALL("fall"),
FISHING_EXP_SP_BONUS("fishingExpSpBonus"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"),
ENCHANT_RATE("enchantRate"),
// VULNERABILITIES // VULNERABILITIES
DAMAGE_ZONE_VULN("damageZoneVuln"), DAMAGE_ZONE_VULN("damageZoneVuln"),
@@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
int newlength = 0; int newlength = 0;
for (Product product : _list) for (Product product : _list)
{ {
if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable())
{ {
newlength++; newlength++;
} }
@@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
for (Product product : _list) 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.writeD(product.getItemId());
packet.writeH(product.getItem().getType2()); // item type2 packet.writeH(product.getItem().getType2()); // item type2
@@ -131,6 +131,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("DoubleCast", DoubleCast::new); EffectHandler.getInstance().registerHandler("DoubleCast", DoubleCast::new);
EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new);
EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new);
EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new);
EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new);
EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new);
EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new);
@@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}
@@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler
final PlayerInstance player = playable.getActingPlayer(); final PlayerInstance player = playable.getActingPlayer();
int level = player.getLevel(); int level = player.getLevel();
final int itemLevel = item.getItem().getCrystalType().getId(); final int itemLevel = item.getItem().getCrystalType().getLevel();
if (level < 20) if (level < 20)
{ {
level = 0; level = 0;
@@ -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. DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to cast two skills at once.
DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius)
EnableCloak: See/unsee cloaks. EnableCloak: See/unsee cloaks.
EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius)
EnemyCharge: Charges towards the enemy. Rush Impact. EnemyCharge: Charges towards the enemy. Rush Impact.
EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc.
EnlargeAbnormalSlot: Increase the amount of buff slots. EnlargeAbnormalSlot: Increase the amount of buff slots.
@@ -2115,7 +2115,7 @@ public class PlayerInstance extends Playable
{ {
if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))) 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 (crystaltype > expertiseLevel)
{ {
if (item.isWeapon() && (crystaltype > weaponPenalty)) if (item.isWeapon() && (crystaltype > weaponPenalty))
@@ -8712,7 +8712,7 @@ public class PlayerInstance extends Playable
{ {
for (int itemId : _activeSoulShots) for (int itemId : _activeSoulShots)
{ {
if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType)
{ {
disableAutoShot(itemId); disableAutoShot(itemId);
} }
@@ -454,7 +454,7 @@ public abstract class Inventory extends ItemContainer
final PlayerInstance player = (PlayerInstance) inventory.getOwner(); final PlayerInstance player = (PlayerInstance) inventory.getOwner();
// Any items equipped that result in expertise penalty do not give any skills at all. // 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; return;
} }
@@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance; 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.EtcItemType;
import org.l2jmobius.gameserver.model.items.type.ItemType; import org.l2jmobius.gameserver.model.items.type.ItemType;
import org.l2jmobius.gameserver.model.stats.Stat;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem
return EnchantResultType.ERROR; 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 bonusRate = getBonusRate();
final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; 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 double random = 100 * Rnd.nextDouble();
final boolean success = (random < finalChance); final boolean success = (random < finalChance);
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
@@ -35,14 +35,14 @@ public enum CrystalType
R99(10, 17371, 30, 500), R99(10, 17371, 30, 500),
EVENT(11, 0, 0, 0); EVENT(11, 0, 0, 0);
private final int _id; private final int _level;
private final int _crystalId; private final int _crystalId;
private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusArmor;
private final int _crystalEnchantBonusWeapon; 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; _crystalId = crystalId;
_crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusArmor = crystalEnchantBonusArmor;
_crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon;
@@ -52,9 +52,9 @@ public enum CrystalType
* Gets the crystal type ID. * Gets the crystal type ID.
* @return 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) public boolean isGreater(CrystalType crystalType)
{ {
return getId() > crystalType.getId(); return getLevel() > crystalType.getLevel();
} }
public boolean isLesser(CrystalType crystalType) public boolean isLesser(CrystalType crystalType)
{ {
return getId() < crystalType.getId(); return getLevel() < crystalType.getLevel();
} }
} }
@@ -183,6 +183,7 @@ public enum Stat
BREATH("breath"), BREATH("breath"),
FALL("fall"), FALL("fall"),
FISHING_EXP_SP_BONUS("fishingExpSpBonus"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"),
ENCHANT_RATE("enchantRate"),
// VULNERABILITIES // VULNERABILITIES
DAMAGE_ZONE_VULN("damageZoneVuln"), DAMAGE_ZONE_VULN("damageZoneVuln"),
@@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
int newlength = 0; int newlength = 0;
for (Product product : _list) for (Product product : _list)
{ {
if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable())
{ {
newlength++; newlength++;
} }
@@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
for (Product product : _list) 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.writeD(product.getItemId());
packet.writeH(product.getItem().getType2()); // item type2 packet.writeH(product.getItem().getType2()); // item type2
@@ -132,6 +132,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("DoubleCast", DoubleCast::new); EffectHandler.getInstance().registerHandler("DoubleCast", DoubleCast::new);
EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new); EffectHandler.getInstance().registerHandler("DuelistFury", DuelistFury::new);
EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new);
EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new);
EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new);
EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new);
EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new);
@@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}
@@ -40,7 +40,7 @@ public class CharmOfCourage implements IItemHandler
final PlayerInstance player = playable.getActingPlayer(); final PlayerInstance player = playable.getActingPlayer();
int level = player.getLevel(); int level = player.getLevel();
final int itemLevel = item.getItem().getCrystalType().getId(); final int itemLevel = item.getItem().getCrystalType().getLevel();
if (level < 20) if (level < 20)
{ {
level = 0; level = 0;
@@ -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. DoubleCast: Triggers Fire, Water, Wind, Earth stance and enables the ability to cast two skills at once.
DuelistFury: Synergy effect for Faceoff effect. (l2jmobius) DuelistFury: Synergy effect for Faceoff effect. (l2jmobius)
EnableCloak: See/unsee cloaks. EnableCloak: See/unsee cloaks.
EnchantRate: Enchant rate modifier, does not work for non grade items. (l2jmobius)
EnemyCharge: Charges towards the enemy. Rush Impact. EnemyCharge: Charges towards the enemy. Rush Impact.
EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc. EnergyAttack: Physical attack based on Momentum formula. Triple Sonic Slash, Double Sonic Slash etc.
EnlargeAbnormalSlot: Increase the amount of buff slots. EnlargeAbnormalSlot: Increase the amount of buff slots.
@@ -2113,7 +2113,7 @@ public class PlayerInstance extends Playable
{ {
if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT))) 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 (crystaltype > expertiseLevel)
{ {
if (item.isWeapon() && (crystaltype > weaponPenalty)) if (item.isWeapon() && (crystaltype > weaponPenalty))
@@ -8698,7 +8698,7 @@ public class PlayerInstance extends Playable
{ {
for (int itemId : _activeSoulShots) for (int itemId : _activeSoulShots)
{ {
if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType) if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType)
{ {
disableAutoShot(itemId); disableAutoShot(itemId);
} }
@@ -466,7 +466,7 @@ public abstract class Inventory extends ItemContainer
final PlayerInstance player = (PlayerInstance) inventory.getOwner(); final PlayerInstance player = (PlayerInstance) inventory.getOwner();
// Any items equipped that result in expertise penalty do not give any skills at all. // 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; return;
} }
@@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance; 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.EtcItemType;
import org.l2jmobius.gameserver.model.items.type.ItemType; import org.l2jmobius.gameserver.model.items.type.ItemType;
import org.l2jmobius.gameserver.model.stats.Stat;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem
return EnchantResultType.ERROR; 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 bonusRate = getBonusRate();
final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0; 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 double random = 100 * Rnd.nextDouble();
final boolean success = (random < finalChance); final boolean success = (random < finalChance);
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE; return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
@@ -35,14 +35,14 @@ public enum CrystalType
R99(10, 17371, 30, 500), R99(10, 17371, 30, 500),
EVENT(11, 0, 0, 0); EVENT(11, 0, 0, 0);
private final int _id; private final int _level;
private final int _crystalId; private final int _crystalId;
private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusArmor;
private final int _crystalEnchantBonusWeapon; 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; _crystalId = crystalId;
_crystalEnchantBonusArmor = crystalEnchantBonusArmor; _crystalEnchantBonusArmor = crystalEnchantBonusArmor;
_crystalEnchantBonusWeapon = crystalEnchantBonusWeapon; _crystalEnchantBonusWeapon = crystalEnchantBonusWeapon;
@@ -52,9 +52,9 @@ public enum CrystalType
* Gets the crystal type ID. * Gets the crystal type ID.
* @return 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) public boolean isGreater(CrystalType crystalType)
{ {
return getId() > crystalType.getId(); return getLevel() > crystalType.getLevel();
} }
public boolean isLesser(CrystalType crystalType) public boolean isLesser(CrystalType crystalType)
{ {
return getId() < crystalType.getId(); return getLevel() < crystalType.getLevel();
} }
} }
@@ -185,6 +185,7 @@ public enum Stat
BREATH("breath"), BREATH("breath"),
FALL("fall"), FALL("fall"),
FISHING_EXP_SP_BONUS("fishingExpSpBonus"), FISHING_EXP_SP_BONUS("fishingExpSpBonus"),
ENCHANT_RATE("enchantRate"),
// VULNERABILITIES // VULNERABILITIES
DAMAGE_ZONE_VULN("damageZoneVuln"), DAMAGE_ZONE_VULN("damageZoneVuln"),
@@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
int newlength = 0; int newlength = 0;
for (Product product : _list) for (Product product : _list)
{ {
if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable()) if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable())
{ {
newlength++; newlength++;
} }
@@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
for (Product product : _list) 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.writeD(product.getItemId());
packet.writeH(product.getItem().getType2()); // item type2 packet.writeH(product.getItem().getType2()); // item type2
@@ -135,6 +135,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("ElementalSpiritAttack", ElementalSpiritAttack::new); EffectHandler.getInstance().registerHandler("ElementalSpiritAttack", ElementalSpiritAttack::new);
EffectHandler.getInstance().registerHandler("ElementalSpiritDefense", ElementalSpiritDefense::new); EffectHandler.getInstance().registerHandler("ElementalSpiritDefense", ElementalSpiritDefense::new);
EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new); EffectHandler.getInstance().registerHandler("EnableCloak", EnableCloak::new);
EffectHandler.getInstance().registerHandler("EnchantRate", EnchantRate::new);
EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new); EffectHandler.getInstance().registerHandler("EnergyAttack", EnergyAttack::new);
EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new); EffectHandler.getInstance().registerHandler("EnlargeAbnormalSlot", EnlargeAbnormalSlot::new);
EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new); EffectHandler.getInstance().registerHandler("EnlargeSlot", EnlargeSlot::new);

Some files were not shown because too many files have changed in this diff Show More