Jump to content
  • 0

Max Blessed And Crystal


bananaspx

Question

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;
	        	}
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock