Addition of enchant_limit item value.
Contributed by CostyKiller.
This commit is contained in:
		| @@ -71,6 +71,7 @@ | ||||
| 					<xs:enumeration value="duration" /> | ||||
| 					<xs:enumeration value="element_enabled" /> | ||||
| 					<xs:enumeration value="enchant_enabled" /> | ||||
| 					<xs:enumeration value="enchant_limit" /> | ||||
| 					<xs:enumeration value="enchant4_skill" /> | ||||
| 					<xs:enumeration value="enchanted" /> | ||||
| 					<xs:enumeration value="equip_condition" /> | ||||
|   | ||||
| @@ -140,6 +140,7 @@ public abstract class Item extends ListenersContainer implements IIdentifiable | ||||
| 	private boolean _tradeable; | ||||
| 	private boolean _depositable; | ||||
| 	private int _enchantable; | ||||
| 	private int _enchantLimit; | ||||
| 	private boolean _elementable; | ||||
| 	private boolean _questItem; | ||||
| 	private boolean _freightable; | ||||
| @@ -214,6 +215,7 @@ public abstract class Item extends ListenersContainer implements IIdentifiable | ||||
| 		 | ||||
| 		_elementable = set.getBoolean("element_enabled", false); | ||||
| 		_enchantable = set.getInt("enchant_enabled", 0); | ||||
| 		_enchantLimit = set.getInt("enchant_limit", 0); | ||||
| 		_freightable = set.getBoolean("is_freightable", false); | ||||
| 		_allowSelfResurrection = set.getBoolean("allow_self_resurrection", false); | ||||
| 		_isOlyRestricted = set.getBoolean("is_oly_restricted", false); | ||||
| @@ -616,6 +618,15 @@ public abstract class Item extends ListenersContainer implements IIdentifiable | ||||
| 		return Arrays.binarySearch(Config.ENCHANT_BLACKLIST, _itemId) < 0 ? _enchantable : 0; | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Returns the enchantment limit of the item | ||||
| 	 * @return int | ||||
| 	 */ | ||||
| 	public int getEnchantLimit() | ||||
| 	{ | ||||
| 		return _enchantLimit > 0 ? _enchantLimit : 0; | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * @return {@code true} if the item can be elemented, {@code false} otherwise. | ||||
| 	 */ | ||||
|   | ||||
| @@ -142,7 +142,7 @@ public abstract class AbstractEnchantItem | ||||
| 		{ | ||||
| 			return false; | ||||
| 		} | ||||
| 		else if (itemToEnchant.isEnchantable() == 0) | ||||
| 		else if ((itemToEnchant.isEnchantable() == 0) || (!(itemToEnchant.getItem().getEnchantLimit() == 0) && (itemToEnchant.getEnchantLevel() == itemToEnchant.getItem().getEnchantLimit()))) | ||||
| 		{ | ||||
| 			return false; | ||||
| 		} | ||||
| @@ -150,7 +150,7 @@ public abstract class AbstractEnchantItem | ||||
| 		{ | ||||
| 			return false; | ||||
| 		} | ||||
| 		else if (((_minEnchantLevel != 0) && (itemToEnchant.getEnchantLevel() < _minEnchantLevel)) && ((_maxEnchantLevel != 0) && (itemToEnchant.getEnchantLevel() >= _maxEnchantLevel))) | ||||
| 		else if (((_minEnchantLevel != 0) && (itemToEnchant.getEnchantLevel() < _minEnchantLevel)) || ((_maxEnchantLevel != 0) && (itemToEnchant.getEnchantLevel() >= _maxEnchantLevel))) | ||||
| 		{ | ||||
| 			return false; | ||||
| 		} | ||||
|   | ||||
| @@ -117,7 +117,7 @@ public class RequestEnchantItem implements IClientIncomingPacket | ||||
| 		} | ||||
| 		 | ||||
| 		// first validation check - also over enchant check | ||||
| 		if (!scrollTemplate.isValid(item, supportTemplate) || (Config.DISABLE_OVER_ENCHANTING && (item.getEnchantLevel() == scrollTemplate.getMaxEnchantLevel()))) | ||||
| 		if (!scrollTemplate.isValid(item, supportTemplate) || (Config.DISABLE_OVER_ENCHANTING && ((item.getEnchantLevel() == scrollTemplate.getMaxEnchantLevel()) || (!(item.getItem().getEnchantLimit() == 0) && (item.getEnchantLevel() == item.getItem().getEnchantLimit()))))) | ||||
| 		{ | ||||
| 			client.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS); | ||||
| 			player.removeRequest(request.getClass()); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment