Addition of EnchantRate effect handler.
Contributed by facab.
This commit is contained in:
@@ -2157,7 +2157,7 @@ public class PlayerInstance extends Playable
|
||||
{
|
||||
if ((item != null) && item.isEquipped() && ((item.getItemType() != EtcItemType.ARROW) && (item.getItemType() != EtcItemType.BOLT)))
|
||||
{
|
||||
crystaltype = item.getItem().getCrystalType().getId();
|
||||
crystaltype = item.getItem().getCrystalType().getLevel();
|
||||
if (crystaltype > expertiseLevel)
|
||||
{
|
||||
if (item.isWeapon() && (crystaltype > weaponPenalty))
|
||||
@@ -8832,7 +8832,7 @@ public class PlayerInstance extends Playable
|
||||
{
|
||||
for (int itemId : _activeSoulShots)
|
||||
{
|
||||
if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getId() == crystalType)
|
||||
if (ItemTable.getInstance().getTemplate(itemId).getCrystalType().getLevel() == crystalType)
|
||||
{
|
||||
disableAutoShot(itemId);
|
||||
}
|
||||
|
@@ -454,7 +454,7 @@ public abstract class Inventory extends ItemContainer
|
||||
final PlayerInstance player = (PlayerInstance) inventory.getOwner();
|
||||
|
||||
// Any items equipped that result in expertise penalty do not give any skills at all.
|
||||
if (item.getItem().getCrystalType().getId() > player.getExpertiseLevel())
|
||||
if (item.getItem().getCrystalType().getLevel() > player.getExpertiseLevel())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -25,8 +25,10 @@ import org.l2jmobius.gameserver.data.xml.EnchantItemGroupsData;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.items.type.CrystalType;
|
||||
import org.l2jmobius.gameserver.model.items.type.EtcItemType;
|
||||
import org.l2jmobius.gameserver.model.items.type.ItemType;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
@@ -215,9 +217,11 @@ public class EnchantScroll extends AbstractEnchantItem
|
||||
return EnchantResultType.ERROR;
|
||||
}
|
||||
|
||||
final int crystalLevel = enchantItem.getItem().getCrystalType().getLevel();
|
||||
final double enchantRateStat = (crystalLevel > CrystalType.NONE.getLevel()) && (crystalLevel < CrystalType.EVENT.getLevel()) ? player.getStat().getValue(Stat.ENCHANT_RATE) : 0;
|
||||
final double bonusRate = getBonusRate();
|
||||
final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0;
|
||||
final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100);
|
||||
final double finalChance = Math.min(chance + bonusRate + supportBonusRate + enchantRateStat, 100);
|
||||
final double random = 100 * Rnd.nextDouble();
|
||||
final boolean success = (random < finalChance) || player.tryLuck();
|
||||
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
|
||||
|
@@ -35,14 +35,14 @@ public enum CrystalType
|
||||
R99(10, 17371, 30, 500),
|
||||
EVENT(11, 0, 0, 0);
|
||||
|
||||
private final int _id;
|
||||
private final int _level;
|
||||
private final int _crystalId;
|
||||
private final int _crystalEnchantBonusArmor;
|
||||
private final int _crystalEnchantBonusWeapon;
|
||||
|
||||
CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon)
|
||||
CrystalType(int level, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon)
|
||||
{
|
||||
_id = id;
|
||||
_level = level;
|
||||
_crystalId = crystalId;
|
||||
_crystalEnchantBonusArmor = crystalEnchantBonusArmor;
|
||||
_crystalEnchantBonusWeapon = crystalEnchantBonusWeapon;
|
||||
@@ -52,9 +52,9 @@ public enum CrystalType
|
||||
* Gets the crystal type ID.
|
||||
* @return the crystal type ID
|
||||
*/
|
||||
public int getId()
|
||||
public int getLevel()
|
||||
{
|
||||
return _id;
|
||||
return _level;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,11 +78,11 @@ public enum CrystalType
|
||||
|
||||
public boolean isGreater(CrystalType crystalType)
|
||||
{
|
||||
return getId() > crystalType.getId();
|
||||
return getLevel() > crystalType.getLevel();
|
||||
}
|
||||
|
||||
public boolean isLesser(CrystalType crystalType)
|
||||
{
|
||||
return getId() < crystalType.getId();
|
||||
return getLevel() < crystalType.getLevel();
|
||||
}
|
||||
}
|
||||
|
@@ -186,6 +186,7 @@ public enum Stat
|
||||
BREATH("breath"),
|
||||
FALL("fall"),
|
||||
FISHING_EXP_SP_BONUS("fishingExpSpBonus"),
|
||||
ENCHANT_RATE("enchantRate"),
|
||||
|
||||
// VULNERABILITIES
|
||||
DAMAGE_ZONE_VULN("damageZoneVuln"),
|
||||
|
@@ -59,7 +59,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
|
||||
int newlength = 0;
|
||||
for (Product product : _list)
|
||||
{
|
||||
if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable())
|
||||
if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable())
|
||||
{
|
||||
newlength++;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class ShopPreviewList implements IClientOutgoingPacket
|
||||
|
||||
for (Product product : _list)
|
||||
{
|
||||
if ((product.getItem().getCrystalType().getId() <= _expertise) && product.getItem().isEquipable())
|
||||
if ((product.getItem().getCrystalType().getLevel() <= _expertise) && product.getItem().isEquipable())
|
||||
{
|
||||
packet.writeD(product.getItemId());
|
||||
packet.writeH(product.getItem().getType2()); // item type2
|
||||
|
Reference in New Issue
Block a user