public abstract class AbstractEnchantPacket extends L2GameClientPacket
{
public static final TIntObjectHashMap<EnchantScroll> _scrolls = new TIntObjectHashMap<>();
public static final class EnchantScroll
{
protected final boolean _isWeapon;
protected final int _grade;
private final boolean _isBlessed;
private final boolean _isCrystal;
public EnchantScroll(boolean wep, boolean bless, boolean crystal, int type)
{
_isWeapon = wep;
_grade = type;
_isBlessed = bless;
_isCrystal = crystal;
}
/**
* @param enchantItem : The item to enchant.
* @return true if support item can be used for this item
*/
public final boolean isValid(L2ItemInstance enchantItem)
{
if (enchantItem == null)
return false;
// checking scroll type and configured maximum enchant level
switch (enchantItem.getItem().getType2())
{
case L2Item.TYPE2_WEAPON:
if (!_isWeapon || (Config.ENCHANT_MAX_WEAPON > 0 && enchantItem.getEnchantLevel() >= Config.ENCHANT_MAX_WEAPON))
return false;
break;
case L2Item.TYPE2_SHIELD_ARMOR:
case L2Item.TYPE2_ACCESSORY:
if (_isWeapon || (Config.ENCHANT_MAX_ARMOR > 0 && enchantItem.getEnchantLevel() >= Config.ENCHANT_MAX_ARMOR))
return false;
break;
default:
return false;
}
// check for crystal type
if (_grade != enchantItem.getItem().getCrystalType())
return false;
return true;
}
/**
* @return true if item is a blessed scroll.
*/
public final boolean isBlessed()
{
return _isBlessed;
}
/**
* @return true if item is a crystal scroll.
*/
public final boolean isCrystal()
{
return _isCrystal;
}
/**
* Regarding enchant system :
*
* Weapons
* <ul>
* <li>magic weapons has chance of 40% until +15 and 20% from +15 and higher. There is no upper limit, there is no dependance on current enchant level.</li>
* <li>non magic weapons has chance of 70% until +15 and 35% from +15 and higher. There is no upper limit, there is no dependance on current enchant level.</li>
* </ul>
* Armors
* <ul>
* <li>non fullbody armors (jewelry, upper armor, lower armor, boots, gloves, helmets and shirts) has chance of 2/3 for +4, 1/3 for +5, 1/4 for +6, ...., 1/18 +20. If you've made a +20 armor, chance to make it +21 will be equal to zero (0%).</li>
* <li>full body armors has a chance of 1/1 for +4, 2/3 for +5, 1/3 for +6, ..., 1/17 for +20. If you've made a +20 armor, chance to make it +21 will be equal to zero (0%).</li>
* </ul>
* @param enchantItem : The item to enchant.
* @return the enchant chance under double format (0.7 / 0.35 / 0.44324...).
*/
public final double getChance(L2ItemInstance enchantItem)
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Powerful Features for Digital Excellence
Experience the difference with our carefully crafted digital products designed to elevate your workflow.
Hey everyone 👋
If you're looking to build your own MMORPG site, forum, or even a fully customized web solution, I've got something you'll want to check out.
I'm teaming up with Modello, a top-tier platform offering professionally designed templates and managed hosting. Whether you're starting a gaming community, a forum hub, or need a sleek custom-built site, Modello has you covered.
🌟 Grab 30% OFF all products and plans using promo code BARRYMANE
👉 Valid on everything—from templates to hosted solutions
Here are two standout options:
🎮 MMORPG Site Template – Eldoria
Build an immersive game showcase or fan portal.
➡️ Preview Eldoria
💬 Feature-Packed Forum Hub
Start your community with ease—modern design, robust features.
➡️ Preview Forum Hub
🛠️ Modello also offers custom websites tailored to your needs, with complete design, hosting, and support included.
Let me know if you need help choosing the right template or want tips on getting started. Happy to share insights and support your project!
Question
killer666
Feliz, Navidad, Merry Christmas.
This is my abstractEnchantPacket.java
:poker face:
I want to register new scrolls correctly and give them a 100% enchant rate.
Anyone can help me?
Is there an easy way? I am aCis user.
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.