-Added all existing enchantment scrolls & lucky stones.
-Full done all scrolls and stones (standard,bless,giant's,safe, -1, etc..) -Added parameters minEnchant, maxEnchantFighter, maxEnchantMagic (minEnchant for Improved stones (+10..+15 only), others for Heavenly Scrolls -Implemented Hair accessory enchant (ONLY IN CORE - ITEMS FOR ENCHANTING NOT DONE, EXCEPT 34717. Also, visual bug when enchanting - "+pdef", but really not gained (same as official servers.) -Added enchant options for hair accessories (increase M. Def. ) -Increased P.Def/M.Def gain when enchanting R grade armor from +1/+3 to +2/+4 (as official). Contributed by NviX.
This commit is contained in:
@ -46,11 +46,29 @@ public abstract class AbstractEnchantItem
|
||||
EtcItemType.SCRL_ENCHANT_WP,
|
||||
EtcItemType.SCRL_INC_ENCHANT_PROP_AM,
|
||||
EtcItemType.SCRL_INC_ENCHANT_PROP_WP,
|
||||
EtcItemType.BLESS_SCRL_INC_ENCHANT_PROP_AM,
|
||||
EtcItemType.BLESS_SCRL_INC_ENCHANT_PROP_WP,
|
||||
EtcItemType.GIANT_SCRL_ENCHANT_AM,
|
||||
EtcItemType.GIANT_SCRL_ENCHANT_WP,
|
||||
EtcItemType.GIANT_SCRL_INC_ENCHANT_PROP_AM,
|
||||
EtcItemType.GIANT_SCRL_INC_ENCHANT_PROP_WP,
|
||||
EtcItemType.GIANT_SCRL_BLESS_INC_ENCHANT_PROP_AM,
|
||||
EtcItemType.GIANT_SCRL_BLESS_INC_ENCHANT_PROP_WP,
|
||||
EtcItemType.SCRL_BLESS_INC_ENCHANT_PROP_AM,
|
||||
EtcItemType.SCRL_BLESS_INC_ENCHANT_PROP_WP,
|
||||
EtcItemType.BLESS_DROP_SCRL_INC_ENCHANT_PROP_AM,
|
||||
EtcItemType.BLESS_DROP_SCRL_INC_ENCHANT_PROP_WP,
|
||||
EtcItemType.GIANT2_SCRL_BLESS_INC_ENCHANT_PROP_AM,
|
||||
EtcItemType.GIANT2_SCRL_BLESS_INC_ENCHANT_PROP_WP,
|
||||
EtcItemType.SCRL_ENCHANT_HR
|
||||
};
|
||||
|
||||
private final int _id;
|
||||
private final CrystalType _grade;
|
||||
private final int _minEnchantLevel;
|
||||
private final int _maxEnchantLevel;
|
||||
private final int _maxEnchantLevelFighter;
|
||||
private final int _maxEnchantLevelMagic;
|
||||
private final double _bonusRate;
|
||||
|
||||
public AbstractEnchantItem(StatsSet set)
|
||||
@ -65,7 +83,10 @@ public abstract class AbstractEnchantItem
|
||||
throw new IllegalAccessError();
|
||||
}
|
||||
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
|
||||
_minEnchantLevel = set.getInt("minEnchant", 0);
|
||||
_maxEnchantLevel = set.getInt("maxEnchant", 65535);
|
||||
_maxEnchantLevelFighter = set.getInt("maxEnchantFighter", 65535);
|
||||
_maxEnchantLevelMagic = set.getInt("maxEnchantMagic", 65535);
|
||||
_bonusRate = set.getDouble("bonusRate", 0);
|
||||
}
|
||||
|
||||
@ -106,6 +127,14 @@ public abstract class AbstractEnchantItem
|
||||
*/
|
||||
public abstract boolean isWeapon();
|
||||
|
||||
/**
|
||||
* @return the minimum enchant level that this scroll/item can be used with
|
||||
*/
|
||||
public int getMinEnchantLevel()
|
||||
{
|
||||
return _minEnchantLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximum enchant level that this scroll/item can be used with
|
||||
*/
|
||||
@ -114,6 +143,22 @@ public abstract class AbstractEnchantItem
|
||||
return _maxEnchantLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximum enchant level that fighter weapon can be enchanted with this scroll
|
||||
*/
|
||||
public int getMaxEnchantLevelFighter()
|
||||
{
|
||||
return _maxEnchantLevelFighter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximum enchant level that magic weapon can be enchanted with this scroll
|
||||
*/
|
||||
public int getMaxEnchantLevelMagic()
|
||||
{
|
||||
return _maxEnchantLevelMagic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemToEnchant the item to be enchanted
|
||||
* @param supportItem
|
||||
@ -133,10 +178,22 @@ public abstract class AbstractEnchantItem
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((_minEnchantLevel != 0) && (itemToEnchant.getEnchantLevel() < _minEnchantLevel))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((_maxEnchantLevel != 0) && (itemToEnchant.getEnchantLevel() >= _maxEnchantLevel))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((_maxEnchantLevelFighter != 0) && !itemToEnchant.getItem().isMagicWeapon() && (itemToEnchant.getEnchantLevel() >= _maxEnchantLevelFighter))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((_maxEnchantLevelMagic != 0) && itemToEnchant.getItem().isMagicWeapon() && (itemToEnchant.getEnchantLevel() >= _maxEnchantLevelMagic))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (_grade != itemToEnchant.getItem().getCrystalTypePlus())
|
||||
{
|
||||
return false;
|
||||
|
@ -25,6 +25,7 @@ import java.util.logging.Level;
|
||||
import com.l2jserver.gameserver.data.xml.impl.EnchantItemGroupsData;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.items.type.EtcItemType;
|
||||
import com.l2jserver.gameserver.model.items.type.ItemType;
|
||||
@ -40,6 +41,8 @@ public final class EnchantScroll extends AbstractEnchantItem
|
||||
private final boolean _isWeapon;
|
||||
private final boolean _isBlessed;
|
||||
private final boolean _isSafe;
|
||||
private final boolean _isGiant;
|
||||
private final boolean _isHair;
|
||||
private final int _scrollGroupId;
|
||||
private Set<Integer> _items;
|
||||
|
||||
@ -49,9 +52,11 @@ public final class EnchantScroll extends AbstractEnchantItem
|
||||
_scrollGroupId = set.getInt("scrollGroupId", 0);
|
||||
|
||||
final ItemType type = getItem().getItemType();
|
||||
_isWeapon = (type == EtcItemType.ANCIENT_CRYSTAL_ENCHANT_WP) || (type == EtcItemType.BLESS_SCRL_ENCHANT_WP) || (type == EtcItemType.SCRL_ENCHANT_WP);
|
||||
_isWeapon = (type == EtcItemType.GIANT_SCRL_ENCHANT_WP) || (type == EtcItemType.ANCIENT_CRYSTAL_ENCHANT_WP) || (type == EtcItemType.BLESS_SCRL_ENCHANT_WP) || (type == EtcItemType.SCRL_ENCHANT_WP);
|
||||
_isBlessed = (type == EtcItemType.BLESS_SCRL_ENCHANT_AM) || (type == EtcItemType.BLESS_SCRL_ENCHANT_WP);
|
||||
_isSafe = (type == EtcItemType.ANCIENT_CRYSTAL_ENCHANT_AM) || (type == EtcItemType.ANCIENT_CRYSTAL_ENCHANT_WP);
|
||||
_isGiant = (type == EtcItemType.GIANT_SCRL_ENCHANT_AM) || (type == EtcItemType.GIANT_SCRL_ENCHANT_WP);
|
||||
_isHair = (type == EtcItemType.SCRL_ENCHANT_HR);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,6 +81,22 @@ public final class EnchantScroll extends AbstractEnchantItem
|
||||
return _isSafe;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} for giant scrolls (enchant attempts has a chance of increasing the enchant value between +1 and +3 randomly), {@code false} otherwise
|
||||
*/
|
||||
public boolean isGiant()
|
||||
{
|
||||
return _isGiant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} for hair enchant scrolls, {@code false} otherwise
|
||||
*/
|
||||
public boolean isHair()
|
||||
{
|
||||
return _isHair;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return id of scroll group that should be used
|
||||
*/
|
||||
@ -109,9 +130,22 @@ public final class EnchantScroll extends AbstractEnchantItem
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (isHair() && (itemToEnchant.getItem().getBodyPart() != L2Item.SLOT_HAIR) && (itemToEnchant.getItem().getBodyPart() != L2Item.SLOT_HAIR2) && (itemToEnchant.getItem().getBodyPart() != L2Item.SLOT_HAIRALL))
|
||||
{
|
||||
_log.info("bodypart: " + itemToEnchant.getItem().getBodyPart());
|
||||
return false;
|
||||
}
|
||||
else if ((supportItem != null))
|
||||
{
|
||||
if (isBlessed())
|
||||
if (isBlessed() && (supportItem.getItem().getItemType() != EtcItemType.BLESS_SCRL_INC_ENCHANT_PROP_WP) && (supportItem.getItem().getItemType() != EtcItemType.BLESS_SCRL_INC_ENCHANT_PROP_AM) && (supportItem.getItem().getItemType() != EtcItemType.BLESS_DROP_SCRL_INC_ENCHANT_PROP_WP) && (supportItem.getItem().getItemType() != EtcItemType.BLESS_DROP_SCRL_INC_ENCHANT_PROP_AM))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (isGiant() && (supportItem.getItem().getItemType() != EtcItemType.GIANT_SCRL_INC_ENCHANT_PROP_WP) && (supportItem.getItem().getItemType() != EtcItemType.GIANT_SCRL_INC_ENCHANT_PROP_AM) && (supportItem.getItem().getItemType() != EtcItemType.GIANT_SCRL_BLESS_INC_ENCHANT_PROP_WP) && (supportItem.getItem().getItemType() != EtcItemType.GIANT_SCRL_BLESS_INC_ENCHANT_PROP_AM) && (supportItem.getItem().getItemType() != EtcItemType.GIANT2_SCRL_BLESS_INC_ENCHANT_PROP_AM) && (supportItem.getItem().getItemType() != EtcItemType.GIANT2_SCRL_BLESS_INC_ENCHANT_PROP_WP))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!isBlessed() && !isGiant() && (supportItem.getItem().getItemType() != EtcItemType.SCRL_INC_ENCHANT_PROP_WP) && (supportItem.getItem().getItemType() != EtcItemType.SCRL_INC_ENCHANT_PROP_AM) && (supportItem.getItem().getItemType() != EtcItemType.SCRL_BLESS_INC_ENCHANT_PROP_WP) && (supportItem.getItem().getItemType() != EtcItemType.SCRL_BLESS_INC_ENCHANT_PROP_AM))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -187,6 +221,14 @@ public final class EnchantScroll extends AbstractEnchantItem
|
||||
{
|
||||
set.set("isSafe", isSafe());
|
||||
}
|
||||
if (isGiant())
|
||||
{
|
||||
set.set("isGiant", isGiant());
|
||||
}
|
||||
if (isHair())
|
||||
{
|
||||
set.set("isHair", isHair());
|
||||
}
|
||||
set.set("chance", Util.formatDouble(chance, "#.##"));
|
||||
if (bonusRate > 0)
|
||||
{
|
||||
|
@ -31,7 +31,14 @@ public final class EnchantSupportItem extends AbstractEnchantItem
|
||||
public EnchantSupportItem(StatsSet set)
|
||||
{
|
||||
super(set);
|
||||
_isWeapon = getItem().getItemType() == EtcItemType.SCRL_INC_ENCHANT_PROP_WP;
|
||||
if ((getItem().getItemType() == EtcItemType.SCRL_INC_ENCHANT_PROP_WP) || (getItem().getItemType() == EtcItemType.BLESS_SCRL_INC_ENCHANT_PROP_WP) || (getItem().getItemType() == EtcItemType.GIANT_SCRL_INC_ENCHANT_PROP_WP) || (getItem().getItemType() == EtcItemType.GIANT_SCRL_BLESS_INC_ENCHANT_PROP_WP) || (getItem().getItemType() == EtcItemType.SCRL_BLESS_INC_ENCHANT_PROP_WP) || (getItem().getItemType() == EtcItemType.BLESS_DROP_SCRL_INC_ENCHANT_PROP_WP) || (getItem().getItemType() == EtcItemType.GIANT2_SCRL_BLESS_INC_ENCHANT_PROP_WP))
|
||||
{
|
||||
_isWeapon = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isWeapon = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,6 +55,21 @@ public enum EtcItemType implements ItemType
|
||||
ANCIENT_CRYSTAL_ENCHANT_AM,
|
||||
RUNE_SELECT,
|
||||
RUNE,
|
||||
GIANT_SCRL_ENCHANT_WP,
|
||||
GIANT_SCRL_ENCHANT_AM,
|
||||
BLESS_SCRL_INC_ENCHANT_PROP_WP,
|
||||
BLESS_SCRL_INC_ENCHANT_PROP_AM,
|
||||
GIANT_SCRL_INC_ENCHANT_PROP_WP,
|
||||
GIANT_SCRL_INC_ENCHANT_PROP_AM,
|
||||
GIANT_SCRL_BLESS_INC_ENCHANT_PROP_WP,
|
||||
GIANT_SCRL_BLESS_INC_ENCHANT_PROP_AM,
|
||||
SCRL_BLESS_INC_ENCHANT_PROP_WP,
|
||||
SCRL_BLESS_INC_ENCHANT_PROP_AM,
|
||||
BLESS_DROP_SCRL_INC_ENCHANT_PROP_WP,
|
||||
BLESS_DROP_SCRL_INC_ENCHANT_PROP_AM,
|
||||
GIANT2_SCRL_BLESS_INC_ENCHANT_PROP_WP,
|
||||
GIANT2_SCRL_BLESS_INC_ENCHANT_PROP_AM,
|
||||
SCRL_ENCHANT_HR,
|
||||
|
||||
// L2J CUSTOM, BACKWARD COMPATIBILITY
|
||||
SHOT;
|
||||
|
Reference in New Issue
Block a user