Skip to content

Max Blessed And Crystal

Featured Replies

Hi guys can help me? How fix this code? I saw on forum another code, but he doesn't work. I him liitle bit fixed but still don't work. What i should to do? I tried add if (_isCrystal) or if (_bisBlessed) but nothing.

what i need to do for fix max enchant?

package net.sf.l2j.gameserver.network.clientpackets;

import java.util.HashMap;
import java.util.Map;

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
import net.sf.l2j.gameserver.model.item.kind.Item;
import net.sf.l2j.gameserver.model.item.kind.Weapon;
import net.sf.l2j.gameserver.model.item.type.CrystalType;
import net.sf.l2j.gameserver.model.item.type.WeaponType;

public abstract class AbstractEnchantPacket extends L2GameClientPacket
{
	public static final Map<Integer, EnchantScroll> _scrolls = new HashMap<>();
	
	public static final class EnchantScroll
	{
		protected final boolean _isWeapon;
		protected final CrystalType _grade;
		private final boolean _isBlessed;
		private final boolean _isCrystal;
		
		public EnchantScroll(boolean wep, boolean bless, boolean crystal, CrystalType 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(ItemInstance enchantItem)
		{
			if (enchantItem == null)
				return false;
			
			// checking scroll type and configured maximum enchant level
			switch (enchantItem.getItem().getType2())
			{
				case Item.TYPE2_WEAPON:
					if (_isWeapon || (Config.ENCHANT_MAX_WEAPON > 0 && enchantItem.getEnchantLevel() >= Config.ENCHANT_MAX_WEAPON))
					return false;
					break;
				
					if (isWeapon)
					if (_isWeapon || (Config.ENCHANT_MAX_BLESSED_WEAPON > 0 && enchantItem.getEnchantLevel() >= Config.ENCHANT_MAX_BLESSED_WEAPON))
					return false;
					break;
					
					if (_isWeapon || (Config.ENCHANT_MAX_CRYSTAL_WEAPON > 0 && enchantItem.getEnchantLevel() >= Config.ENCHANT_MAX_CRYSTAL_WEAPON))
					return false;
					break;		
					
					case Item.TYPE2_SHIELD_ARMOR:
	                if (_isWeapon || (Config.ENCHANT_MAX_ARMOR > 0 && enchantItem.getEnchantLevel() >= Config.ENCHANT_MAX_ARMOR))
	                return false;
	                break;

	                if (_isWeapon || (Config.ENCHANT_MAX_BLESSED_ARMOR > 0 && enchantItem.getEnchantLevel() >= Config.ENCHANT_MAX_BLESSED_ARMOR))
	                return false;
	                break;
	                
	                if (_isWeapon || (Config.ENCHANT_MAX_CRYSTAL_ARMOR > 0 && enchantItem.getEnchantLevel() >= Config.ENCHANT_MAX_CRYSTAL_ARMOR))
	                return false;
	                break;
	                    
	                case Item.TYPE2_ACCESSORY:
	                if (_isWeapon || (Config.ENCHANT_MAX_JEWELS > 0 && enchantItem.getEnchantLevel() >= Config.ENCHANT_MAX_JEWELS))
	                return false;
	                break;

	                if (_isWeapon || (Config.ENCHANT_MAX_BLESSED_JEWELS > 0 && enchantItem.getEnchantLevel() >= Config.ENCHANT_MAX_BLESSED_JEWELS))
	                return false;
	                break;
	                
	                if (_isWeapon || (Config.ENCHANT_MAX_CRYSTAL_JEWELS > 0 && enchantItem.getEnchantLevel() >= Config.ENCHANT_MAX_CRYSTAL_JEWELS))
	        		return false;
	        		break;
	        				
	                default:
	        		return false;
	        	}

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.