Skip to content

L2AEPvP Enchant System

Featured Replies

This share is gold for those who know how to use it, it basically unhard-codes all enchant scrolls and gives you the ability to create any scroll with a simple //reload items.

Tested on L2AEPvP (Beta), more details:

 

 

sample XML (very basic)

	<item id="45000" type="EnchantScroll" name="Scroll: Enchant Weapon">
		<set name="default_action" val="skill_reduce" />
		<set name="etcitem_type" val="scrl_enchant_wp" />
		<set name="is_oly_restricted" val="true" />
		<set name="is_stackable" val="true" />
		<set name="handler" val="EnchantScrolls" />
		
		<set name="scroll_binds" val="WEAPON" />
		
		<rates rate="0">
			<tiertarget tier="ANY" rate="0" disprate="80">
				<enchtarget enchants="0-3" rate="100" /> <!-- SAFE -->
				<enchtarget enchants="4-8" rate="80" />
				<enchtarget enchants="9-11" rate="75" />
				<enchtarget enchants="12-15" rate="70" />
				<enchtarget enchants="15" rate="45" disprate="60"/>
				<enchtarget enchants="16,17" rate="60" />
				<enchtarget enchants="18" rate="40" />
				<enchtarget enchants="19" rate="20" />
			</tiertarget>
			<tiertarget tier="COMMON" rate="90" maxench="25" >
				<enchtarget enchants="0,1,2,3,4" rate="100" maxench="25" /> <!-- SAFE -->
			</tiertarget>
		</rates>
		
		<fails penalty="CRYSTALLIZE" >
			<tiertarget tier="UNCOMMON" penalty="NONE" basevalue="0" >
				<enchtarget enchants="7,8,9,10,11,12" penalty="NONE" value="4"/>
				<enchtarget enchants="13,14,15" penalty="DEC" value="1"/>
			</tiertarget>
		</fails>
	</item>

 

Features:

    The possibilities are hundreds, you can create enchant scrolls that can enchant a very specific tier, enchant scrolls that have their own max enchant and so on

    You can calculate the enchant rates and inform the player before the enchant

    Item Grades are obviously ignored

 

Things you have to do to get this working:

1) Create TIERS (enum) and assign it to items

2) Create EnchantFailed (enum) and implement the penalty code

3) Create ScrollBinds (enum) and assign it to each paperdoll

 

Additional things you will need

 

	public static <V extends Enum<V>> EnumSet<V> toEnumSet(String enumStr, Class<V> enumClass)
	{
		if (enumStr == null)
			return EnumSet.noneOf(enumClass);
		final String[] enumStrings = enumStr.replace(" ", "").split(",");
		final EnumSet<V> enums = EnumSet.noneOf(enumClass);
		for (String e : enumStrings)
			enums.add(Enum.valueOf(enumClass, e));
		return enums;
	}

 

	public static int[] toIntArrayEx(String[] strArray)
	{
		final ArrayList<Integer> intList = new ArrayList<>(strArray.length);
		
		for (int i=0;i<strArray.length;i++)
		{	try
			{	
				final String strNum = strArray[i];
				if (strNum.contains("-"))
				{
					final String[] explode = strNum.split("-");
					final int min = Integer.parseInt(explode[0]);
					final int max = Integer.parseInt(explode[1]);
					if (min < max) for (int j = min; j <= max; j++)
						intList.add(j);
				}
				else
					intList.add(Integer.parseInt(strNum));
			}
			catch (Exception e)
			{	e.printStackTrace();
			}
		}
		
		return intList.stream().mapToInt(i->i).toArray();
	}

 

Good luck

Edited by xxdem

Nice one bud, thanks for sharing it with us!

1 hour ago, Designatix said:

Nice one bud, thanks for sharing it with us!

Like anyone will know how to import it.

Great job tho my old pal xDem!

  • 3 weeks later...

can use in acis rev 350

 

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.